Answer the question
In order to leave comments, you need to log in
Why is the find command not working?
Why does this command
Doesn't delete the necessary files
Tried mtime and ctime
ls -lc output
find . -type f -ctime +30 -delete
[email protected]:~/backup_mysql/30-04-2021# ls -lc
total 12564
-rw-r--r-- 1 root root 1829972 Apr 30 17:00 17-00-01.tar.bz2
-rw-r--r-- 1 root root 1832426 Apr 30 18:00 18-00-01.tar.bz2
-rw-r--r-- 1 root root 1832644 Apr 30 19:00 19-00-01.tar.bz2
-rw-r--r-- 1 root root 1836240 Apr 30 20:00 20-00-02.tar.bz2
-rw-r--r-- 1 root root 1838100 Apr 30 21:00 21-00-01.tar.bz2
-rw-r--r-- 1 root root 1839485 Apr 30 22:00 22-00-01.tar.bz2
-rw-r--r-- 1 root root 1840507 Apr 30 23:00 23-00-01.tar.bz
Answer the question
In order to leave comments, you need to log in
Because you need -ctime +29
$ man find
...
-atime n
File was last accessed n*24 hours ago. When find figures out how many 24-hour periods ago the file was last
accessed, any fractional part is ignored, so to match -atime +1, a file has to have been accessed at least two days
ago.
...
-ctime n
File's status was last changed n*24 hours ago. See the comments for -atime to understand how rounding affects the
interpretation of file status change times.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question