![]() Or ! -type d to consider all types of files except directories. To delete only regular files (and exclude all other types of files including fifos, sockets, directories, symlinks.), add -type f before -delete. So if an old file is removed from a directory, that directory won't be removed even if it was over an hour old at the time find was started.Īlso note that for files of type symlink, it's the age of the symlink itself, not that of the target of the symlink that is being considered. ![]() ![]() Also note that removing a file from a directory does update the last modification time of that directory, and -delete implies -depth meaning that files are processed before the directory where they're found in. That deletes all files regardless of their type, though note that it won't delete files of type directory if they're not empty. ![]() So would not select the files whose age is in-between 60 and 61 minutes. Note that -mmin +60 would select the files whose age in minutes rounded up to the next integer is strictly greater than 60. Here using the -mmin and -delete extensions of GNU find, as found on Ubuntu and other GNU-based systems. To delete the files whose name starts with master-stdout.log and that have not been modified in the last hour, recursively under /root/logs/: LC_ALL=C find /root/logs/ -name 'master-stdout.log*' -mmin +59 -delete delete files older then a month Red Squirrel: Linux - Software: 1: 10-05-2005 10:54 PM: delete files older than 30 days using cronjob: latheesan: Linux - Newbie: 5: 06-14-2005 02:40 PM: Files delete from SAMBA server: klmn1: Linux - General: 2: 04-17-2004 02:34 AM: How to delete pass 30 days email: linuxalliance: Linux - Networking: 3: 04-04.
0 Comments
Leave a Reply. |