Find mmin, mtime, cmin not working

Dear All,
We are having the script which is creating the folder on another server if it is not present using ssh. Using scp it copies copy all pdf files from local folder to server folder.

After all copy is done, Just to verify i was using the below find command

find /my_loc/my01/RPD/XP1023/OUT/ -type f -mmin 120 | wc -l

now I again transfer 400 file but when i use above command it give me wrong count.

just to mention script is creating any random folder under /OUT and copying the file.

find /my_loc/my01/RPD/XP1023/OUT/random-folder

I also tried and it did not work

find /my_loc/my01/RPD/XP1023/OUT/*/ -type f -mmin 120 | wc -l

i tried mtime, cmin nothing seems working.

can somebody please help me what i am doing wrong.

Are the counts the same after the copy or below/above?
Perhaps you're using the -P (preserve times) flag with scp.

Why not try ls -l of a file you did copy and check it's timestamp.

1 Like

Use signed numbers with all the time tests in find. man find:

So, if you want to find files copied/modified within the last 120 minutes, use -120. Trying to find files dealt with EXACTLY 120 min ago, the result might be sparse.

2 Likes

The issue was i was using 120 rather than -120

thanks again