![]() |
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 |
| shell script preserving last 2 versions of files | synergy_texas | Shell Programming and Scripting | 6 | 10-29-2008 12:58 PM |
| Mac OS X 10.4: Optional Installs may install previous versions of certain application | iBot | OS X Support RSS | 0 | 09-27-2008 07:12 AM |
| script to delete files | looza | Shell Programming and Scripting | 3 | 07-11-2008 10:56 AM |
| script to delete files | vats | Shell Programming and Scripting | 12 | 09-01-2007 05:27 AM |
| Need to delete previous line after successful seearch | pbsrinivas | Shell Programming and Scripting | 7 | 10-31-2006 11:55 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Need a script to delete previous versions of files
Hi.
I need a script (either bash or perl) that can delete previous versions of files. For instance, from our continuous build process I get directories such as build5_dev_1.21 build5_dev_1.22 build5_dev_1.23 build5_dev_1.24 I need a script that I can run every night (using "at" command) that deletes all but the last 1 or 2, such that when the script runs tonight, if the limit is 2, I end up with only the following two directories. build5_dev_1.23 build5_dev_1.24 if a new build is created during the day the directory ill be named build5_dev_1.25 and after the script runs I will have directories build5_dev_1.24 build5_dev_1.25 left. Ideally I only need to save the "latest" build (the one with the highest "1.xx" number), but i would like the option to save "n" builds, so that I can always have the last 2 or even 3 around if I want. I am not well versed in script building, my main job is software development, and maintaining the builds is a side task that I write scripts for when i get tired of doing the repetitive tasks by hand. As a consequence I do the scripting so seldom that I have to re-learn alot each time I start a new script. that's why I'm asking for any pointers anyone would be willing to give. thanks ! Joe Simon |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|