0

I have two different linux based systems where the find command doesn't seem to be working as expected.

I have a directory. In it I run...

ls -l

and the system returns...

drwxr-xr-x 2 panopticon36 panopticon36 4096 May 22 12:28 folder1
drwxr-xr-x 2 panopticon36 panopticon36 4096 May 22 12:28 folder2
drwxr-xr-x 2 panopticon36 panopticon36 4096 May 22 12:25 folder3
drwxr-xr-x 2 panopticon36 panopticon36 4096 May 24 09:52 folder4

today is 5/24/17.

In the same directory, if I run...

find . -mtime +1 -type d

the system returns nothing.

From my understanding, the find command should find all directories "-type d" in the current directory "." that are more than 1 day old "-mtime +1". So...

folder1
folder2
folder3

should all be listed to my understanding. Two systems under my care are exhibiting this behavior. Am I doing something incorrectly or missing something? Could something be modifying directories in such a way that ls -l does not reflect the correct date modified? Is there something else I could attempt to troubleshoot the issue? All help is welcome.

1 Answers1

2

Due to the weird way the mtime is rounded up, +1 means "48 hours or more". This is documented on the man page.

The way to memorize it is to start from the most basic use: -mtime 1 which means that file was accessed 24 hours ago plus any fraction (for example 24+23 hours would also match). From this follows "logically" what +1 and -1 mean.

kubanczyk
  • 14,252