Difference between revisions of "Mtime"
Jump to navigation
Jump to search
↑ https://unix.stackexchange.com/questions/194863/delete-files-older-than-x-days
Tags: Mobile web edit, Mobile edit |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
https://askubuntu.com/questions/589210/removing-files-older-than-7-days | https://askubuntu.com/questions/589210/removing-files-older-than-7-days | ||
− | [[find]] /path/to/ -type f -mtime +7 -name '*.gz' -execdir rm -- '{}' \; | + | [[find]] /path/to/ -type f -mtime +7 -name '*.gz' -execdir [[rm]] -- '{}' \; |
− | |||
+ | [[find]] /path/to/directory/ -mindepth 1 -mtime +5 -print | ||
+ | [[find]] /path/to/directory/ -mindepth 1 -mtime +5 -delete <ref>https://unix.stackexchange.com/questions/194863/delete-files-older-than-x-days</ref> | ||
+ | == Related terms == | ||
+ | * <code>-exec</code> | ||
== See also == | == See also == | ||
* {{find}} | * {{find}} | ||
+ | * {{files}} | ||
+ | |||
+ | |||
+ | [[Category:Linux]] |
Latest revision as of 13:55, 8 September 2020
https://askubuntu.com/questions/589210/removing-files-older-than-7-days
find /path/to/ -type f -mtime +7 -name '*.gz' -execdir rm -- '{}' \;
find /path/to/directory/ -mindepth 1 -mtime +5 -print find /path/to/directory/ -mindepth 1 -mtime +5 -delete [1]
Related terms[edit]
-exec
See also[edit]
find
,find .
,ls
,findmnt, locate
,-mindepth, -name, -delete
- file, File system, directory,
touch
,mkdir
,ls
,ln
truncate
,fallocate
,split
,stat
, inode, File descriptor, superblock, block size (blockdev
),fuser
,lsof
,scrub
,chattr
, ulimit (nofiles),cp
,mv
,file (command)
,mkfifo
,chmod
Advertising: