The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-16-2008
rstone rstone is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 3
check to see if a file is compressed before trying to compress

I simply need to compress all files in a directory that are not already compressed and that are older than 10 days?

I have this so far. I need to add to this so I don't try and compress file that are already compressed. Or if you think this can be simplified let me know. Thx.

find /my/dir -name "*.xml*" -mtime +10 -ls
find /my/dir -name "*.xml*" -mtime +10 -exec gzip -f {} \;

Thanks for reading