find negative search


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find negative search
# 1  
Old 05-12-2009
find negative search

I have a config file as below. This file is delimited by ; First field is the starting directory for find command. Second field is -mtime value for the find command. Third field is combination of folder and file delimited by |

/home/export/temp;+30;file1|dir1|file2
/home/software/dir;+40;great|sing|folder

I now want to take above as input parameter for a find/script which will delete all files excluding the files/folder mentioned in the third field starting from the directory mentioned in field 1 and which are some days old mentioned in field 2.

Requesting some suggestion on how to do it.
# 2  
Old 05-12-2009
Hammer & Screwdriver the find command with -prune option

find and -prune are the key commands.
Take a look at:
https://www.unix.com/unix-advanced-ex...ne-option.html
# 3  
Old 05-13-2009
find negative search

Thanks for the response. Requesting to give more clarity as i am unable to get it correctly. The reply (mentioned as url, doesnt have complete answer and moreover the exclusion list that i mentioned might have files as well as folders).
# 4  
Old 05-13-2009
Code:
find /home/export/temp -follow \( -name "file1" -o -name "file2"\) -mtime +30 -prune -o -print

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sed/awk to find negative numbers and replace with 1?

Greetings. I have a three column file, and there are some numbers in the second column that are <1. However I need all numbers to be positive, thus need to replace all those numbers with just one. I feel like there must be a simple way to use awk to find these numbers and sed to replace but can't... (5 Replies)
Discussion started by: Twinklefingers
5 Replies

2. UNIX for Dummies Questions & Answers

Use ls or find for search of subdirectories?

(5 Replies)
Discussion started by: jhsinger
5 Replies

3. Shell Programming and Scripting

Search: find current line, then search back

Hello. I want to find a line that has "new = 0" in it, then search back based on field $4 () in the current line, and find the first line that has field $4 and "last fetch" Grep or Awk preferred. Here is what the data looks like: 2013-12-12 12:10:30,117 TRACE last fetch: Thu Dec 12... (7 Replies)
Discussion started by: JimBurns
7 Replies

4. UNIX for Dummies Questions & Answers

find Search - Find files not matching a pattern

Hello all, this is my first and probably not my last question around here. I do hope you can help or at least point me in the right direction. My question is as follows, I need to find files and possible folders which are not owner = AAA group = BBB with a said location and all sub folders ... (7 Replies)
Discussion started by: kilobyter
7 Replies

5. Shell Programming and Scripting

In a row, replace negative sign and find minimum value among four columns

Hi Friends, I have an input file like this chr1 100 200 1 2 3 4 chr1 150 200 4 5 6 7 chr2 300 400 9 6 7 1 chr2 300 410 -10 21 -11 13 chr3 700 900 -21 -22 130 165 Now, my output file is chr1 100 200 1 chr1 150 200 4 chr2 300 400 1 chr2 300 410 10 chr3 700 900 21 Remove... (5 Replies)
Discussion started by: jacobs.smith
5 Replies

6. Shell Programming and Scripting

Find Where Values Change From Positive To Negative and viceversa

Hi all, I have a file that looks like shown below. I want to find places where the value in column 2 change from negative to positive and vice versa and return the value on column 1 at that point. I wonder if this is possible in shell script or awk .. please help! Here is the original data ... (6 Replies)
Discussion started by: malandisa
6 Replies

7. Shell Programming and Scripting

How to search for a file without using find or which?

Hello, I am a newbie to Unix shell script writing. I have to write a Korn or Bash shell script to search for a file, where some file named <filename> is given at the prompt. So let's say the script command will be called locate_file. Then one could enter locate_file filename. The... (1 Reply)
Discussion started by: TPaine_4liberty
1 Replies

8. Shell Programming and Scripting

search and find

Good Morning Team, Looking for some help on shell scripting please I need to search recursivly through a tree of directorys for a file I will input and text I am looking for, so the input would look like this: ./search.sh /var/www iframe And display the path and file name if... (5 Replies)
Discussion started by: stewartrose
5 Replies

9. UNIX for Advanced & Expert Users

to search files using find

hi friens, :) if ther are files named .c++,.C++,.cpp,.Cpp,.CPp,.cPP,.CpP,.cpP,.c,.C wat is the pattern for finding them :confused: (0 Replies)
Discussion started by: arunsubbhian
0 Replies
Login or Register to Ask a Question