cron job for deleting files older than 1 week
Carsten Aulbert
carsten at welcomes-you.com
Fri Mar 9 12:16:30 UTC 2007
Gabriel Dragffy wrote:
> Could some one provide me with a sample script that I could run as a
> cron job and it would go through the streamripper folder deleting files
> older than 1 week (for example). Many thanks.
> gabe
Again, use with care ;)
find /path -name "stream*.mp3" -mtime +6 | xargs -i rm -f {}
That should delete all files named "stream*.mp3" found in the directory
hierarchie /path with modification date older than 6 days.
For mor info, please read the man page of find, xargs and rm and try the
stuff first with 'echo' instead of rm to make sure you don't delete
anything you don't want to delete.
HTH
Carsten
More information about the ubuntu-users
mailing list