Ikon
1
I'm tring to:
find files recursively older than x days that contain dat or DAT then tar them
I can find the files older than 90 days containing dat with this:
find . -mtime +90 -type f -name "*dat*" -exec tar -cvvfp /some/path/some.tar {} \;
but how do I do it case insensitive?
find . -mtime +90 -type f -name "*dat*" and "*DAT*" -exec tar -cvvfp /some/path/some.tar {} \;
EDIT: Im using HP-UX so there is no "-iname" for the find command.
---------- Post updated at 11:05 AM ---------- Previous update was at 10:19 AM ----------
I found that this would not work anyway.. It creates a new tar file everytime it finds a file.
But I did figure out how to do it.
tar cvvfp /path/to/some.tar `find . -mtime +90 -type f | grep -i "dat"`
Sorry this is not much help. I always thought you could do something like:
find . \(-name '.txt' -o -name '.TXT'\) -print
But I've just tried it on my HP-UX and it gives:
find: bad option -o
man find
suggests -o is valid, though
expression -o expression Logical OR operator. True if either or
both of the expressions are true.
Good luck in finding your answer.
Try this:
find /* -mtime +90 -type f -name "*dat*" -or -name "*DAT*" - exec tar -cvvfp /some/path/some.tar {} \;
Works for me on RH
Seen my error! you can use this form of construct for your or clause if you wish. Have tested on HP-UX and it throws up my .txt and .TXT files
find . \( -name \.txt -o -name \.TXT \) -print
./env.txt
./dir.txt
./shella.txt
./taila.txt
./tailb.TXT
./number.txt
./finished.txt
./dir2.txt
./shellb.txt
./cutshellb.txt
./tailb.txt
./numberb.txt
./result_c.txt
Regards