in with lines it it, like: Batch file to delete files older than N days. This command will run rm only once at the end instead of each time a file is found and this command is almost as fast as using -delete option as following in modern find: find /path/to/ -type f -mtime +7 -name '*. Use the following command to delete last character of each line in Bash: rev. So the fixed command would be: find /path/to/ -type f -mtime +7 -name '*.gz' -execdir rm - '' + In any case, for both -find -mtime +30 and zsh 's m+30 glob qualifier, note that it selects files that are 31 days old or older, as it compares the age in terms of integer number of days. +7 will then remove the files older than 168 hours. oldfiles (/h/USER/.txt (NDm+30/)) if ( (oldfile)) then rm -f - oldfiles else echo >&2 No text files to del fi. RT3070Guest Account Features: Upload 50 Files At a Time (500mb max), Mp3 and Mp4 Files Only, Max 500 Files Per Person, Direct Download Urls Last 30 days. As pointed out you missed a space between name and '*.gz' also for speeding up the command use -type f option to running the command on files only. The following should work: for x in find
-type f -mtime +14 do lsof 'x' >/dev/null & echo 'x in use' echo 'x not in use' done Instead of the echo 'x not in use' command, you can place your rm 'x' command. However, I've just tested that and it looks like it doesn't only rely on the date info, but also on the hours and minutes. Here I am going to tell you how to delete backup files older than 30 days through bash scripts or command line, which help to save your system, server space &.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |