Script help - delete files older than 45 days but exclude the system files
Not sure where to ask this so here it goes:
I admin an FTP server that has multiple users all rooted under the /data dir. I am creating a script to find all files in /data that are older than 45 days and deleting them. I have this script: Code:
#! /bin/bash I also have a similar file to delete all the ._* files created by Mac systems: Code:
#! /bin/bash Can someone please explain what the differences are between: Code:
find / -name * | xargs rm |
Scripting questions often end up in /Programming. Anyway. You could string together exclusions like "and not iname something and not iname something". Wrt "-exec vs xargs", xargs is faster. See for instance http://tldp.org/LDP/Bash-Beginners-G...ect_09_07.html. Not related to 'find' here, but xargs can also be used to work around "too many args" globbing errors.
|
Quote:
|
Try "find /data -mindepth 3 -mtime +45 -type f -not -iname .bash\* -a -not -iname ._\*"?
|
All times are GMT -5. The time now is 04:51 PM. |