- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- -mtime+1 does not return 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
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-17-2011 02:31 AM
09-17-2011 02:31 AM
-mtime+1 does not return expected results
Hi All,
OS :- HPUX 11.11
I have following files with the extention of *.aud. I was trying to find out *auf files older than 1 days. I used the following command in order to get the desired result, but the below query didn't behave the way, it should be. Please help me, where i get this wrong ?
1325 Sep 15 11:43 ora_18256.aud 658 Sep 15 11:43 ora_20226.aud 1323 Sep 15 11:43 ora_20125.aud 661 Sep 15 11:43 ora_20123.aud 1989 Sep 15 11:43 ora_20088.aud 1969 Sep 15 11:43 ora_20098.aud 230 Sep 16 15:03 fdr_tables.sh 40770 Sep 16 16:18 drop_objects.sql 1423212 Sep 16 16:49 fdrb_tables.sql 10405 Sep 16 16:56 fdrb_status.sql 391 Sep 17 04:28 test.sh cpmqa> find *.aud* -type f -mtime +1 -exec ls -ltr {} + oradev1 oracpmqa /db/cpmqa/export/backup
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2011 06:23 AM
09-17-2011 06:23 AM
Re: -mtime+1 does not return expected results
Hi:
You want:
find . -name "*.aud*" -type f -mtime +1 -exec ls -ltr {} +
That is, look in the current directory for files ('-type f' whose basename matches ".aud" and whose last modification time is (24-hours) or older. The "-name', '-type' and '-mtime' specifications are ANDed together.
Your problem was that 'find *.aud* ...' says to 'find' in the path(s) that the shell discovered by expanding "*.aud*" whereas you wanted to match names to this pattern.
Re-read the 'find' manpages and practice with some cases of your own.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2011 11:47 AM
09-17-2011 11:47 AM
Re: -mtime+1 does not return expected results
>Your problem was that 'find *.aud* ...' says to 'find' in the path(s) that the shell discovered by expanding "*.aud*" whereas you wanted to match names to this pattern.
There is nothing wrong with using the pattern in the list of files to search, provided you don't want to descend into subdirectories. (Unless there are too many of those files or you figure that having the both the shell and find(1) doing the search is excessive.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2011 01:12 PM
09-17-2011 01:12 PM
Re: -mtime+1 does not return expected results
@Dennis Handly wrote:There is nothing wrong with using the pattern in the list of files to search, provided you don't want to descend into subdirectories.
Right, but the OP's description of "I have following files with the extention of *.aud. I was trying to find out *auf files older than 1 days." suggests that only files with that extension are desired. The output shown includes other suffixes. Of course given the problem description provided we are both left to guess a bit :-)
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2011 02:30 PM
09-17-2011 02:30 PM
Re: -mtime+1 does not return expected results
>the OP's description of "I was trying to find out *auf files older than 1 days." suggests that only files with that extension are desired.
(I assumed it was a typo and you must have too, since you have: -name "*.aud*")
>The output shown includes other suffixes.
I assumed that was the input.
>Of course given the problem description provided we are both left to guess a bit :-)
Yes. Not sure what was input or output.