- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- -mtime does not return the expected results
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2011 06:23 AM
09-14-2011 06:23 AM
Hi All,
OS :- HPUX 11.11
I was trying to use this -mtime attribute to get the files older then n days. But, when I do run this, It'll display all the files, irrespetive of , what is being mentioned. The below code, tried to fetch files older then 14 days, but it is strange to see, it's returning all the files. Please suggest, if I did any thing wrong ??
find . -type f -mtime +14 -exec | ls -ltr 12933 Jul 16 04:04 qa02_reco_4513.trc 577 Jul 17 02:30 qa02_lgwr_21693.trc 577 Jul 17 18:08 qa02_lgwr_13310.trc 575 Jul 24 02:30 qa02_lgwr_6387.trc 575 Jul 24 14:54 qa02_lgwr_4182.trc 12825 Jul 29 14:41 qa02_reco_4493.trc 577 Jul 31 02:31 qa02_lgwr_27979.trc 577 Jul 31 21:16 qa02_lgwr_15239.trc 25020 Aug 5 22:49 qa02_reco_4487.trc 575 Aug 7 02:30 qa02_lgwr_4826.trc 577 Aug 7 23:36 qa02_lgwr_18840.trc 575 Aug 14 02:30 qa02_lgwr_1376.trc 577 Aug 14 20:41 qa02_lgwr_15341.trc 25572 Aug 20 00:33 qa02_reco_4525.trc 575 Aug 21 02:30 qa02_lgwr_3738.trc 577 Aug 21 22:07 qa02_lgwr_28938.trc 12825 Aug 26 22:25 qa02_reco_4518.trc 575 Aug 28 02:30 qa02_lgwr_1917.trc 575 Aug 28 20:51 qa02_lgwr_8401.trc 930 Sep 2 00:29 qa02_j000_25855.trc 930 Sep 3 00:32 qa02_j000_13883.trc 12933 Sep 3 08:51 qa02_reco_4507.trc 577 Sep 4 02:30 qa02_lgwr_29439.trc 577 Sep 4 22:14 qa02_lgwr_27388.trc 12933 Sep 10 01:04 qa02_reco_4500.trc 575 Sep 11 02:30 qa02_lgwr_4959.trc 577 Sep 11 23:03 qa02_lgwr_28954.trc 3978306 Sep 14 06:48 alert_qa02.log 11393 Sep 14 06:48 qa02_reco_4522.trc
Regards
Hare Krishna
Solved! Go to Solution.
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2011 07:00 AM
09-14-2011 07:00 AM
Re: -mtime does not return the expected results
Hi:
You wrote:
# find . -type f -mtime +14 -exec | ls -ltr
...where you should have written:
# find . -type f -mtime +14 -exec ls -ltr {} +
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2011 12:00 PM
09-14-2011 12:00 PM
Re: -mtime does not return the expected results
The other option you have is to do:
find . -type f -mtime +14 | xargs ls -ltr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2011 04:18 AM - edited 09-15-2011 05:25 AM
09-15-2011 04:18 AM - edited 09-15-2011 05:25 AM
Solution>The other option you have is to do:
The problem with xargs is the buffer is trivially small compared to the ~1 M or so in -exec ... +.
The ll -t output will be in smaller chunks, so won't be "sorted" very well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2011 05:01 AM
09-15-2011 05:01 AM
Re: -mtime does not return the expected results
Thanks for your help, it really worked for me. ,also what is the purpose of '+' in the end? Is there any point system, which I can offer the points for?
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2011 05:03 AM
09-15-2011 05:03 AM
Re: -mtime does not return the expected results
Hi Patrik,
Your solution is also worked!
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2011 05:23 AM
09-15-2011 05:23 AM
Re: -mtime does not return the expected results
>also what is the purpose of '+' in the end?
There are two forms for -exec:
-exec command args ... ; This only does one file at a time.
-exec command args ... {} + This does as many files as will fit.
The latter is better because it can reduce the number of times "command" is invoked, thus saving start up costs.
But "command" must be able to take parms like: command args ... file1 file2 ...
>Is there any point system, which I can offer the points for?
Click on the Kudos! stars on each reply that deserves one.