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

Have a look at command file

Hi,
the *.xml*pattern will include already gzipped files, if they as by default get an extension of .gz. Wouldn't it work with *.xml instead?

/Lakris

Then try the command:

strings your_file | grep xml