rugman_66
asked on
Bash script to remove files in directory but exlude by owner
Hello,
I'm new to Bash scripting, and need a scrip to run as a cron that will remove all files recursively
in specific directories, but exclude any files owned by specific users. How can this be done?
Thank you
I'm new to Bash scripting, and need a scrip to run as a cron that will remove all files recursively
in specific directories, but exclude any files owned by specific users. How can this be done?
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks farzanj
I added a few options, and works great!
-John
I added a few options, and works great!
-John
/path/to/dir is the path of directory under which you want to do a recursive search
In this command, I didn't want to remove files owned by root
find /path/to/dir -not -user root -type f -exec rm '{}' \;