- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script for Finding modified files in last 24hr...
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
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
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-2006 04:09 AM
тАО09-14-2006 04:09 AM
I need a script that will find all the files in a particular directory that have been modified in the last 24 hrs.
TIA
Sri
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 04:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 04:24 AM
тАО09-14-2006 04:24 AM
Re: script for Finding modified files in last 24hrs
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 04:35 AM
тАО09-14-2006 04:35 AM
Re: script for Finding modified files in last 24hrs
$ date
Thu Sep 14 12:35:24 EDT 2006
$ touch -t 0609131234 testfile
$ ls -l
total 32
-rw-r--r-- 1 fifejj users 0 Sep 13 12:34 testfile
$ find . -mtime -1
.
./.sh_history
$ touch -t 0609131244 testfile
$ find . -mtime -1
.
./.sh_history
./testfile
The -newer approach is certainly the way to go if you ever want increments more granular than a 24-hour period, though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 04:43 AM
тАО09-14-2006 04:43 AM
Re: script for Finding modified files in last 24hrs
works every time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 04:48 AM
тАО09-14-2006 04:48 AM
Re: script for Finding modified files in last 24hrs
Whether you choose to use '-mtime' for 24-hour granularity or the '-newer' switch for granularity down to seconds of time, *limit* what is returned to *files* with '-type f' and add the '-xdev' switch to prevent crossing mountpoints. For example:
# find / -xdev -type f -mtime -2 | xargs ls -l
...would search the root ('/') directory looking for files (but not directories) that have been modified in the last 48-hours (2-days). This will likely expose some files in '/etc/ which is a subdirectory of '/' but it will *not* cross mountpoints (e.g. '/usr')!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 04:51 AM
тАО09-14-2006 04:51 AM
Re: script for Finding modified files in last 24hrs
# find /work1 -mtime -1 -exec ll {} \; |head -1
total 699798
-rw-rw-r-- 1 jjo develop 223969 Mar 23 2004 #allflex.txt#
# find /work1 -mtime +1 -exec ll {} \; |head -1
-rw-rw-r-- 1 root informix 21186 Sep 11 23:28 /work1/logs/www/2006-0
9-11.user_verif
# find /work1 -mtime 1 -exec ll {} \; |head -6
-rw-rw-r-- 1 root informix 53 Sep 13 11:19 /work1/logs/www/06-09-
13.prodcnt
I still think the -newer approach is the only way to be accurate.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 05:04 AM
тАО09-14-2006 05:04 AM
Re: script for Finding modified files in last 24hrs
You are seeing the fallacy of not confining your search to *files*:
Compare these:
# find /path -mtime -1 -exec ll {} \; | head
# find /path -type f -mtime -1 -exec ll {} \; | head
In the first case, recently modified directories are examined by the 'ls'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 05:07 AM
тАО09-14-2006 05:07 AM