![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| read file from tar.gz archive | krylin | High Level Programming | 9 | 05-20-2009 04:51 PM |
| File Archive Script | KeesH | Shell Programming and Scripting | 10 | 06-09-2008 11:11 AM |
| Purge files based on timestamp avl in file name | sureshg_sampat | Shell Programming and Scripting | 3 | 02-29-2008 11:28 AM |
| read list of filenames from text file, archive, and remove | fxvisions | Shell Programming and Scripting | 5 | 03-20-2007 09:56 PM |
| Updating a File in a Zip Archive | dbridle | AIX | 6 | 09-27-2006 03:29 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Read from file then purge or archive.
Hi All,
I have a root directory /tmp and I want to purge files or archive files in its subsequent subfolders.I listed the path of files I want to purge(archive) and the #of days. (purge) DAYS PATH 7 /tmp/arsenal/* 5 /tmp/chelsea/* (archive? the same as above but different folders To purge I want to use find $PATH -type f -mtime +$DAYS -exec rm {} \; The problem now is, in order to do this,I need to first read the DAYS and PATH from the files which I am struggling to do. I tried this cat 'filestopurge.txt' | while read DAYS PATH do case $AGE in *) find ........ Please dont forget that it will be read from a file filestopurge.txt Please advise. Regards, Dougy |
|
||||
|
followup
I executed your script against the filestopurge.txt and got this:
./purgeam.sh ./purgeam.sh[4]: find: not found ./purgeam.sh[4]: find: not found ./purgeam.sh[4]: find: not found the filestopurge.txt looks like this: DAY PATH 90 /interface/backup/dbmig/tmp/* 100 /interface/backup/dbmig/* Your script apparently read the DAY as 90 and the path, and executes the command. Am I right? |
![]() |
| Bookmarks |
| Tags |
| mtime |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|