Operating System - Linux
1827794 Members
2381 Online
109969 Solutions
New Discussion

Re: Find command - advanced (!) use

 
SOLVED
Go to solution
Kevin McKie
Occasional Advisor

Find command - advanced (!) use

Hi, Everyone.

I have an archive directory containing several subdirectories, one of which is called "secure". I need to compress all files in all the subdirs (using compress -f or compressdir -f) EXCEPT the files in "secure" - they may be needed at an instant's notice. Your help would be much appreciated.
Si monumentum requiris, ecce Washington.
5 REPLIES 5
Steven Mertens
Trusted Contributor

Re: Find command - advanced (!) use

hi

you can try the following


for dir in $(find archivedir -type d |grep -v secure)
do

compress -rf $dir

done

You can also take a look at the tar and
gzip command.

Steven
Peter Kloetgen
Esteemed Contributor

Re: Find command - advanced (!) use

Hi Kevin,

i know the Linux- find also, but it's the same here than in HP-UX, sorry....

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Craig Kelley
Valued Contributor
Solution

Re: Find command - advanced (!) use

find . --exclude ./secure --exec compress -f {} \;
Kevin McKie
Occasional Advisor

Re: Find command - advanced (!) use

Hi, guys -

Apologies for the posting here - it should have gone into the HP-UX forum, not Linux.

Thanks for your help anyway.

Kevin
Si monumentum requiris, ecce Washington.
Gregory Fruth
Esteemed Contributor

Re: Find command - advanced (!) use

dir=some_directory
find $dir \! -path $dir/secure -exec compressdir -f {} \;