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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Is it possible to see the content of the compressed file? bobprabhu UNIX for Advanced & Expert Users 2 06-19-2008 04:55 AM
How to search for text within compressed file HLee1981 UNIX for Advanced & Expert Users 8 09-06-2007 06:50 AM
Check if file compressed or not badg3r Shell Programming and Scripting 4 09-14-2006 04:58 AM
renaming a compressed file to filename without .Z bruceps UNIX for Dummies Questions & Answers 8 08-16-2005 02:32 AM
Import data from compressed file ap_gore79 Shell Programming and Scripting 4 06-18-2004 01:39 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #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
  #2 (permalink)  
Old 11-16-2008
bsddaemon's Avatar
bsddaemon bsddaemon is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 37
Have a look at command file
  #3 (permalink)  
Old 11-17-2008
Lakris Lakris is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 246
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
  #4 (permalink)  
Old 11-17-2008
bsddaemon's Avatar
bsddaemon bsddaemon is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 37
Then try the command:

strings your_file | grep xml
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0