If you wanted to search for, and erase every file on your system named 'bahdouche' execute:
find / -name bahdouche -type f -exec rm -f {} \;
If you wanted to do a 'test run' before you actually killed them all, use the 'echo' command nested in the command line:
find / -name bahdouche -type f -exec echo rm -f {} \;
To find every file owned by the user named 'bahdouche' execute:
find / -user bahdouche -printThe -print flag is optional on some systems.
Find every file that has no user associated:
find / -nouserLet's say you run a mail server with pam accounts and maildirs and you wanted to have a cron job that deletes their Spam folders every 30 days; add this to crontab:
find /home/*/Maildir/.Spam -type f -mtime +30 -exec rm -f {} \;This obviously would have to be modified if the Spam folders were named differently.
No comments:
Post a Comment