- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Find command
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
Forums
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
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
02-07-2002 05:39 AM
02-07-2002 05:39 AM
0 * * * * /usr/bin/find /u03/oradata/archprod -mtime +1 -exec rm {} \;
This seams to be working but in the directory it is keeping two days worth of stuff. I want all log files older than one day to be removed. I look and there is currently files from 02/05/02 on on the hour of the script. Any suggestions on how to only keep one day (24 hours) of files?
Thanks
Larry
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2002 05:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2002 05:45 AM
02-07-2002 05:45 AM
Re: Find command
You are telling find to find all files older the +1 days. What is bigger than 1? 2. Change to +0. Warning: always test your find's with a safe statement like -exec echo {} \; BEFORE doing the real thing will -exec rm {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2002 05:46 AM
02-07-2002 05:46 AM
Re: Find command
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2002 05:48 AM
02-07-2002 05:48 AM
Re: Find command
A "day" to 'find' is a 24-hour period. If you want to refine your criteria further, you can touch a reference file and use the '-newer' option (negated or not, as necessary).
# touch -a -m -t 200202070700 /tmp/ref
# find /tmp -type f -newer /tmp/ref
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2002 05:49 AM
02-07-2002 05:49 AM
Re: Find command
I found a reference to the mtime which suggests the following.
-mtime option looks at
-1 since yesterday ( as within 24 hours)
1 yesterday (between 24 and 48 hours old)
+1 before yesterday (48 hours or older)
Explanation of the argument n is explained in the expressions part of the man page for find(1) and your HP-UX Reference.
steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2002 06:00 AM
02-07-2002 06:00 AM
Re: Find command
http://www.fnal.gov/docs/products/perl/pod.new/5.00503/pod/perlfaq5.html#How_do_I_get_a_file_s_timestamp_
Also, you can get Gnu's find, which allows MINUTE searches:
http://www.gnu.org/manual/findutils-4.1/html_mono/find.html#SEC15
live free or die
harry