Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find and compress the file without .z 2

Status
Not open for further replies.

peac3

Technical User
Jan 17, 2009
226
AU
Hi Guys,

We have number of files in some directories that we need to compress, so basically we want to compress each file older than 2 days but excluded some files in each directory that have been compressed (with extension .Z)

Can you please give me the one liner :

I found something like this
Code:
find dir1 dir2 dir3 -type f -mtime +2 ! -name "*.Z" | xargs compress

but not sure whether it's working in unix solaris 10.
anything simpler than this?

cheers,
 
Why bother excluding - compress will spot the compressed files and skip them. You will get lots of warning messages but, if you're confident the rest works
Code:
find dir1 dir2 dir3 -type f -mtime +2|xargs compress 2>/dev/null



On the internet no one knows you're a dog

Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top