PDA

View Full Version : deleting directory of files


chrispadfield
Mon 15th Oct '01, 6:31pm
How can you in linux, delete a directory of files where either all the files were created before x or all the files are less than x kb?

Is it possible?

Chris Schreiber
Mon 15th Oct '01, 9:15pm
cd /path/to/dir
find . -mtime +365 -print | xargs rm -f
# (where +365 is older then 365 days)
find . -size -100 -print | xargs rm -f
# (where -100 is less then 100k)

(leave off the " | xargs rm -f" part to just see the list of files)

chrispadfield
Mon 15th Oct '01, 9:16pm
thanks Chris, that looks perfect. going to try.