"find" command used with "mtime" primary producing unexpected results
| Originator: | peter.hentrich | ||
| Number: | rdar://12599218 | Date Originated: | 30 October 2012 |
| Status: | Closed | Resolved: | |
| Product: | OS X | Product Version: | 10.5.8 |
| Classification: | No value | Reproducible: | Yes |
Summary: I want to use the UNIX command "find" in the Terminal to list all files in the current directory that are older than 3600 seconds. I want to use the "-mtime" primary to test for modification time/date. Steps to Reproduce: Type the following in a Terminal window: find . -mtime +3600s -maxdepth 1 Expected Results: That it would list all files older than 3600 seconds (1 hour). Actual Results: It lists all files older than 3600 days. It isn't acknowledging the unit "s" for seconds nor any other unit correctly such as "h" for hours, "d" for days. Regression: Notes: find . -mtime +3600w -maxdepth 1 The above command lists all items in the directory. It doesn't seem to recognise the "w" at all for "weeks". Results below: --------------- admin@imac1:~$ls -lat total 112 -rw------- 1 admin wheel 251 30 Oct 23:16 .lesshst drwxr-xr-x 22 admin wheel 748 30 Oct 22:12 bin -rw------- 1 admin staff 12950 30 Oct 18:11 .bash_history drwxr-xr-x 19 admin wheel 646 30 Oct 16:43 . -rw-r--r-- 1 admin wheel 62 30 Oct 16:32 .vimrc drwx------+ 11 admin wheel 374 30 Oct 16:08 Downloads -rw-r--r--@ 1 admin staff 21508 30 Oct 13:00 .DS_Store drwx------+ 9 admin wheel 306 29 Oct 19:47 Documents drwx------+ 9 admin wheel 306 29 Oct 15:55 Music drwx------ 31 admin wheel 1054 28 Oct 13:19 .Trash -rw------- 1 root wheel 2522 26 Oct 01:27 .viminfo drwx------+ 31 admin wheel 1054 16 Oct 18:24 Library drwxr-xr-x 6 root admin 204 16 Oct 18:16 .. drwxr-xr-x+ 5 admin wheel 170 28 Jan 2011 Public -rw------- 1 admin wheel 3 28 Jan 2011 .CFUserTextEncoding drwx------+ 3 admin wheel 102 28 Jan 2011 Desktop drwx------+ 3 admin wheel 102 28 Jan 2011 Movies drwx------+ 4 admin wheel 136 28 Jan 2011 Pictures drwxr-xr-x+ 5 admin wheel 170 28 Jan 2011 Sites admin@imac1:~$find . -mtime +3600s -maxdepth 1 admin@imac1:~$find . -mtime +3600m -maxdepth 1 admin@imac1:~$find . -mtime +3600h -maxdepth 1 admin@imac1:~$find . -mtime +3600d -maxdepth 1 admin@imac1:~$find . -mtime +3600w -maxdepth 1 . ./.bash_history ./.CFUserTextEncoding ./.DS_Store ./.lesshst ./.Trash ./.viminfo ./.vimrc ./bin ./Desktop ./Documents ./Downloads ./Library ./Movies ./Music ./Pictures ./Public ./Sites admin@imac1:~$find . -mtime +100s -maxdepth 1 ./.CFUserTextEncoding ./Desktop ./Movies ./Pictures ./Public ./Sites admin@imac1:~$find . -mtime +100 -maxdepth 1 ./.CFUserTextEncoding ./Desktop ./Movies ./Pictures ./Public ./Sites admin@imac1:~$sw_vers -productVersion 10.5.8 admin@imac1:~$uname -a Darwin imac1.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 ./Sites
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!