-# find and delete the files which are older than a given parameter (seconds/minutes/hours)
- $ rm -f /Dir/**/*(.mh+3) # deletes all regular file in /Dir that are older than 3 hours
- $ rm -f /Dir/**/*(@mm+3) # deletes all symlinks in /Dir that are older than 3 minutes
- $ rm -f /Dir/**/*(ms+30^/) # deletes all non dirs in /Dir that are older than 30 seconds
- $ rm ./**/*(.Dmh+1,.DL0) # deletes all folders, sub-folders and files older than one hour
- $ rm -f **/*(mh+6) # deletes all files more than 6 hours old
- $ rm ./*(Om[1,-11]) # removes all files but the ten newer ones (delete all but last 10 files in a directory)
- Note: If you get a arg list too long, you use the builtin rm. For example:
- $ zmodload zsh/files ; rm -f **/*(mh+6)
+# find and delete the files which are older than a given parameter
+# (seconds/minutes/hours)
+ # deletes all regular file in /Dir that are older than 3 hours
+ $ rm -f /Dir/**/*(.mh+3)
+ # deletes all symlinks in /Dir that are older than 3 minutes
+ $ rm -f /Dir/**/*(@mm+3)
+ # deletes all non dirs in /Dir that are older than 30 seconds
+ $ rm -f /Dir/**/*(ms+30^/)
+ # deletes all folders, sub-folders and files older than one hour
+ $ rm ./**/*(.Dmh+1,.DL0)
+ # deletes all files more than 6 hours old
+ $ rm -f **/*(mh+6)
+ # removes all files but the ten newer ones (delete all but last 10
+ # files in a directory)
+ $ rm ./*(Om[1,-11])
+ Note: If you get a arg list too long, you use the builtin rm. For
+ example:
+ $ zmodload zsh/files ; rm -f **/*(mh+6)