![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Reg: delete older files from ftp | sam99 | UNIX for Dummies Questions & Answers | 3 | 01-09-2008 10:56 AM |
| tar'ing and zipping files | FredSmith | UNIX for Dummies Questions & Answers | 4 | 05-02-2006 04:09 PM |
| rm files older than ... | annemar | UNIX for Dummies Questions & Answers | 2 | 02-08-2006 05:47 AM |
| files older than 15 minutes | sveera | Shell Programming and Scripting | 0 | 08-05-2005 03:05 PM |
| tar files older than 30 days | wfch | UNIX for Dummies Questions & Answers | 6 | 04-19-2004 05:40 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Zipping files older than one month
I have to zip all files older than a month within a directory.
I have to archive them using the file extension I have .dat, .csv ,.cnt files within the directory. I used the following command It doesnt work find /path/*.dat -mtime +30 This command doesnot display .dat files older than a month I used a different method which is tedious, but does the zipping month wise zip dat_zip.zip `ls -rtl *.dat|grep Jan |awk '{print $9}'` After doing this I have the zip files in the zip directory, but if i remove Jan files from the folder using this command ls -rtl *.dat | grep Jan | awk '{print $9}' | rm *.dat I lose all the dat files for other months too. As per my knowledge '|' gives o/p from previous command as I/p for next command , why am i losing all the .dat files(from other months too) Guru's Please shed some light. Thanks and Regards, Ram. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|