Visit Our UNIX and Linux User Community

Find mmin, mtime, cmin not working

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find mmin, mtime, cmin not working
# 1  
Old 05-21-2013
RedHat 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.

Last edited by yadavricky; 05-22-2013 at 11:52 AM..
# 2  
Old 05-22-2013
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.
This User Gave Thanks to Chubler_XL For This Post:
# 3  
Old 05-22-2013
Use signed numbers with all the time tests in find. man find:
Numeric arguments can be specified as
+n for greater than n,
-n for less than n,
n for exactly n.
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.
These 2 Users Gave Thanks to RudiC For This Post:
# 4  
Old 05-22-2013
Originally Posted by RudiC
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.
The issue was i was using 120 rather than -120

thanks again

Previous Thread | Next Thread
Test Your Knowledge in Computers #84
Difficulty: Easy
Windows 3.1, Windows 95, Windows 98, and Windows ME were all based on DOS.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Any alternative for mmin or cmin parameter

Hi, I need to write a shell script where I need to check whether log file is generated in last 1 hour or not. But I am getting below error in using mmin or cmin parameter with find command: find: bad option -mmin find: bad option -cmin So my concern is that any alternative for mmin option... (5 Replies)
Discussion started by: Ankit Srivastav
5 Replies

2. UNIX for Dummies Questions & Answers

Find command mmin

Hi, Please tell me what the below command wil do, according to my understanding it finds files in the current and sub directories whose modification time is 5 hrs and it dont zip the already zipped files who's size is more than 4K. Am I Correct? find . -type f -mmin +300 ! -name... (1 Reply)
Discussion started by: nag_sathi
1 Replies

3. Red Hat

Deleting using "find -mtime" not working

This command used to work in my old Linux servers to delete old files (older than 2 days, in this case) but it suddenly not working at all-- find /path/to/dir/* -mtime 2 -exec rm {} \; Anything I am missing? Would appreciate any tips. Thanks! (6 Replies)
Discussion started by: pkiula
6 Replies

4. Shell Programming and Scripting

-$arg not working for find mmin

Hi, I want to parameterise the argument for 'mmin' to find out files created/edited 'n' minutes ago. For this i have written something as simple as the following: n=10 m=-1 c=expr $n \* $m #value comes to -10 when echoed find -mmin -10 #works find -mmin $c #doesnt work ... (5 Replies)
Discussion started by: SheetalN
5 Replies

5. UNIX for Dummies Questions & Answers

Relatively simple question regarding find and cmin

Nuts and bolts: I have a log file that should be updated once every minute called OD_MEM.log. I want to add a check to my CheckSystem script that confirms that the log has been written to in the last 2 minutes. If I use the find command with cmin 1, it finds the file every time. If I use the... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

6. UNIX for Dummies Questions & Answers

(find) mtime vs. (unix) mtime

Hi I've made some test with perl script to learn more about mtime... So, my question is : Why the mtime from findfind /usr/local/sbin -ctime -1 -mtime -1 \( -name "*.log" -o -name "*.gz" \) -print are not the same as mtime from unix/linux in ls -ltr or in stat() function in perl : stat -... (2 Replies)
Discussion started by: hiddenshadow
2 Replies

7. Shell Programming and Scripting

mmin not working in ksh

We have created a unix shell script to read a datafiles from specific input directory in Unix. Users will be copying datafiles to the same input unix directoty. During Testing we observed Unix Shell Script also read the incomplete datafiles which is still copying by the users. As per requirement... (1 Reply)
Discussion started by: Kumari Reshma
1 Replies

8. Solaris

AIX to SOLARIS conversion - (find -cmin option)

I have a piece of code (below) in a .ksh script running on AIX. I need to convert the code to run .zsh on Solaris. Solaris's find command does not support the -cmin function. Suggestions?? The code searchs for a file (_filename) and determines if it has been written to or modified in the last... (1 Reply)
Discussion started by: nmalencia
1 Replies

9. UNIX for Advanced & Expert Users

find -cmin or fin -newer

I am running SUSE/8 and SUSE/9 on a high end server (4 CPU, 8G RAM etc) I have a huge directory structure with over 4million files in it. I have find the files that are modified (created, modified, renamed etc etc) in the last 10 minutes periodically. I have tried "find -cmin -10" and "find... (2 Replies)
Discussion started by: xxxyyyy
2 Replies

10. UNIX for Dummies Questions & Answers

no [find -mmin -1]

I wanna show all files minute old, one hour old, five hours old and so on... in my OS (HP-UX) there's only the command .. find -name "..." -mtime -n but this is only for days, there isn't something like -mmin -n ...just don't know what to do. also the newer than option isn't... (3 Replies)
Discussion started by: svennie
3 Replies

Featured Tech Videos