![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do you list the most recent files writen to a volume | williamhsman | OS X (Apple) | 1 | 10-12-2007 09:19 AM |
| Get Files from ftp which are uploaded recent week | narramadan | Shell Programming and Scripting | 1 | 09-27-2007 05:05 AM |
| getting the most recent file | anujairaj | Shell Programming and Scripting | 3 | 06-22-2006 12:34 PM |
| delete files except most recent | ST2000 | Shell Programming and Scripting | 5 | 06-21-2005 11:33 AM |
| Recent Changes To Forum ... | Cameron | Post Here to Contact Site Administrators and Moderators | 2 | 03-08-2002 06:57 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
To keep only the most recent files
Hi all,
I'm running on a Sun Solaris machine. I would only want to keep the last 2 most recent files on 1 of my directory. Below shows my script, but it is incomplete. For the ?? part I do not know how to continue. please help DIR=/tmp/abc OUTPUT=/tmp/output.out OUTPUT1=/tmp/output1.out cd $DIR ls -rt | tail -2 > $OUTPUT ls > $OUTPUT1 cat $OUTPUT1 | while read archive do if [ "$archive" = ?? ]; then echo "Keeping ..." else rm $archive fi done Thank you. |
| Forum Sponsor | ||
|
|