I'm trying to remove all files more than 1 days old.Before I execute a script to remove the files,I try to find the files using mtime. however, I face same problem with my command-
My Current date is
Wed Jan 27 11:49:20 BDT 2016
My file lists are-
Jan 25 15:11 25-01-2016.txt
Jan 26 13:05 26-01-2016.txt
Jan 27 02:30 27-01-2016.txt
Jan 25 15:11 dfk-25-01-2016.txt
Jan 26 13:05 dfk-26-01-2016.txt
Jan 27 02:30 dfk-27-01-2016.txt
I thought -mtime +1
was supposed to list all files over a day old.
find /etc/output/*.txt -mtime +1
find /etc/output/*.txt -mtime +0
/output/25-01-2016.txt
/output/dfk-25-01-2016.txt
find /etc/output/*.txt -mtime -1
/output/26-01-2016.txt
/output/27-01-2016.txt
/output/dfk-26-01-2016.txt
/output/dfk-27-01-2016.txt
My desired out output is as followings,
find /etc/output/*.txt -mtime +1
/output/25-01-2016.txt
/output/dfk-25-01-2016.txt
find /etc/output/*.txt -mtime +0
/output/26-01-2016.txt
/output/dfk-26-01-2016.txt
/output/25-01-2016.txt
/output/dfk-25-01-2016.txt
-mtime +0
to show only the files for the 26th? Maybe you mean-mtime +0 -mtime -1
? – Otheus Jan 27 '16 at 10:05