Try:
Code:
find . -type f -mtime +7 -exec rm {} \;
Understand the above command
will delete files one-at-a-time as matching files are found.
You can also try this script:
Code:
#!/bin/bash
find . -type f -mtime + 7 | \
while read filename ; do
echo "rm \"${filename}\""
#rm "${filename}"
done
I have not tested the above script. You need to do that yourself if you want to use it.
The script
should display the rm commands it would execute. Then, if you are satisfied the script is finding the right files (and will execute the correct rm command), then remove the comment mark ('#') from the rm command and re-run the script to actually delete the files. Keep in mind, that you must run the script from the top directory you wish to work from--because the find command uses the '.' for the path.