0

I have the below files in directory new:

Dec 14 04:35 New_folder
Dec 13 05:50 abc.sh
Dec 13 06:33 ashutosh.txt
Dec 13 06:40 delete.sh
Dec 13 07:19 test.bat
Dec 14 04:44 test.sh
Dec 14 04:30 xyz.sh

And running the below command

find /test/new/ -type f -mtime +1

According to definition of this command I will get all files which are older than one day, on 14 Dec when I am running, but I am not getting any file in the output.

What is a command line that works?

1 Answers1

1

find rounds up to the nearest 24-hour period; this encompasses all of your files:

If no units are specified, this primary evaluates to true if the
difference between the file last modification time and the
time find was started, rounded up to the next full 24-hour period,
is n 24-hour periods.

To check this, try touch -t on one of your files:

touch -t 12011200 abc.sh

If you re-run your find command you should now see abc.sh (because your touch command set the last access/modification time of abc.sh to be December 1st, at 12:00).

John N
  • 1,951