- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Finding files that are n days before date
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
11-20-2002 04:23 AM
11-20-2002 04:23 AM
Hi,
How can I find files in a directory that are for example 3 or 4 days old using the find command:
find -atime "????" /data1 -print
Thanks,,,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 04:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 04:33 AM
11-20-2002 04:33 AM
Re: Finding files that are n days before date
As usual Pete is fast and rigth ... The complete syntax from the man page states :
In the descriptions of the primaries, the argument n represents a decimal integer; +n means more than n, -n means less than n, and n means exactly n.
so :
3 days old --> -mtime 3
more than 3 days old --> -mtime +3
less than 3 days old --> -mtime -3
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 04:37 AM
11-20-2002 04:37 AM
Re: Finding files that are n days before date
# touch -mt 11160000 /tmp/ref
# cd
# find . ! -newer /tmp/ref
...finds files older than 11/16/2002...
# find . -newer /tmp/ref
...find files modified since 11/16...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 04:41 AM
11-20-2002 04:41 AM
Re: Finding files that are n days before date
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 04:57 AM
11-20-2002 04:57 AM
Re: Finding files that are n days before date
Hi,
Thanks gurus,,,
That was fast. Faster than news flash thses days...
Appriciate your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 05:12 AM
11-20-2002 05:12 AM
Re: Finding files that are n days before date
The use of 'mtime' (and its cousins 'atime' and 'ctime') base "day" on a 24-hour interval. In most cases this yields the user what is sought. If more granularity in time is desired when isolating files, the use of '-newer' with a reference file is an appropriate choice.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2002 10:18 AM
11-24-2002 10:18 AM
Re: Finding files that are n days before date
Hi again,,
I have 2 directories data1 and data2. Say under each is:
.../data1/sales
.../data1/logs
.../data1/suppliers
.../data2/sales
.../data2/logs
.../data2/suppliers
I want to search both directories and delete (rm -r) the sales directory and all files below it. "" Safely "". How to do that ??And what if one of the directories names are randomly generated by some program ?? say data1/bcgfrty
(Remove the bcgfrty directory) ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2002 12:02 PM
11-24-2002 12:02 PM
Re: Finding files that are n days before date
To remove the "sales" directories, just do
rm -rf .../data1/sales .../data2/sales
With of course replacing the "..." with the appropriate "PATH". Now if you have more than just "data1" and "data2", say like up to data9, then this will work:
rm -rf .../data[0-9]/sales
As for "RANDOMLY" created directory names, you could do this to delete those and the "sales" directories:
cd to appropriate directory
find ./data[0-9]/* -type d -depth ! -name suppliers -a ! -name logs -exec rm -rf {} \;
OF COURSE, YOU SHOULD NEVER JUST EXECUTE A rm -rf WITHOUT FIRST DETERMINING IF IT IS GOING TO DO WHAT YOU WANT IT TO DO, so do this first:
find ./data[0-9]/* -type d -depth ! -name suppliers -a ! -name logs -exec echo rm -rf {} \;
live free or die
harry