'difference between mtime +0 and mtime 0

I an using mtime with find . I am duing it for first time . I see a script which moves file from one location to other.

 `find . \ -mtime +0 -exec mv {} target \ ;`

I want to understand does +0 means only for file created before 24 hrs? Now as these files are moved to target i also want to modify there permission to one appropiate for everyone to read. So i used the command

 `find target -mtime 0 -exec chmod 644 {} \;`

I want to really get hole of difference between usage of +0 , 0 . Does 0 only signified between now and 24 hr while +0 is from 24 and more old ? My main purpose here is to modify the permission of all files in target dir where i have just moved them . As they can be many i jst want to run one command and do it all.



Solution 1:[1]

I recommend that you consult the documentation prior to asking for help. The man-age for find explains numeric test:

+n  for greater than n,
-n  for less than n,
 n  for exactly n.

and clarifies their interpretation with regard to file timestamp tests -atime, -ctime, and -mtime:

-mtime n
   File's  data  was last modified less than, more
   than or exactly n*24 hours ago.  See  the  com-
   ments for -atime to understand how rounding af-
   fects the interpretation of  file  modification
   times.

-atime n
   File  was last accessed less than, more than or
   exactly 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 ac-
   cessed at least two days ago.

As you can see, +0 means older than 24 hours and 0 within the last 24 hours.

Solution 2:[2]

   +n     for greater than n days,
   -n     for less than n days,
    n     for exactly n days.

+0 - all files older than now , which will be all files in your directory

-0 - all files newer than now , means no files

0 - all files modified now - you will get /root/.bash_history if you are doing it in /root folder as it gets modified instantly

for 24hrs you can use +1,-1,1

+1 will be all files which are older than 1 day

-1 will be all files which are old up to 1 day

1 will be all files which are exact 1 day old

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ant_222
Solution 2 thatguy