Re: shell script question
IMM whatever cycle you're doing this over you don't really need to do any calculating. What I mean is, if you do this every day but only want 3 days-worth of backups then sort by date and delete everything but the newest 3 copies:
/bin/rm -f dummy `/bin/ls -t <filename spec> | sed -e 1,3d`
Those are backticks, "N" in "Nd" controls how many copies and obviously test this out where you can do no irreparable damage.
And pick your <filename spec> well enough to ensure that the only thing "ls" parses is the group of files you intend it to examine.
|