- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Files 15 mins older than sysdate
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
тАО05-14-2009 08:00 AM
тАО05-14-2009 08:00 AM
Does anyone know how I can get find to give me a list of files within a directory that is 15 minutes or more older that the current system date? Or does anyone have a handy little script that does this? More than this I need really a count of how many files are within a directory that are 15 minutes or more older than the system date.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 08:10 AM
тАО05-14-2009 08:10 AM
Re: Files 15 mins older than sysdate
cd /my/directory
find ./ -newer /tmp/dummyfile | wc -l
hope this helps
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 08:10 AM
тАО05-14-2009 08:10 AM
Re: Files 15 mins older than sysdate
You can use:
# perl -MFile::Find -le '$path=shift||qq(.);find(sub{print $File::Find::name if -f $_ && -M _ <= (15/(60*60*24))},$path)' /dirname
If you omit the "/dirname" argument, your current working directory will be examined.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 08:12 AM
тАО05-14-2009 08:12 AM
Re: Files 15 mins older than sysdate
get current time using date
manipulate that time by subtracting 15 minutes
use find with -older to find files matching
pipe results to "wc -l"
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 08:12 AM
тАО05-14-2009 08:12 AM
Re: Files 15 mins older than sysdate
Oops, you want files _OLDER_ so:
# perl -MFile::Find -le '$path=shift||qq(.);find(sub{print $File::Find::name if -f $_ && -M _ >= (15/(60*60*24))},$path)' /directory
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 08:18 AM
тАО05-14-2009 08:18 AM
Re: Files 15 mins older than sysdate
Can't locate File/Find.pm in @INC (@INC contains: /opt/perl5/lib/5.00502/PA-RISC1.1 /opt/perl5/lib/5.00502 /opt/perl5/lib/site_perl/5.005/PA-RISC1.1 /opt/perl5/lib/site_perl/5.005 .).
BEGIN failed--compilation aborted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 08:22 AM
тАО05-14-2009 08:22 AM
Re: Files 15 mins older than sysdate
find ./ ! -newer /tmp/dummyfile
Notice the '!' prior to the '-newer' to make it not newer than the /tmp/dummyfile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 08:23 AM
тАО05-14-2009 08:23 AM
Re: Files 15 mins older than sysdate
Perl 5.005 is OLD. If you want, update to a current (5.8.8 or later) version:
http://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=PERL
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 08:34 AM
тАО05-14-2009 08:34 AM
Re: Files 15 mins older than sysdate
I'm sorry, NO POINTS FOR THIS CORRECTION, but for 15 _minutes_ use:
(15/(60*24))
NOT:
(15/(60*60*24))
...which represents 15 _seconds_
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2009 01:20 AM
тАО05-15-2009 01:20 AM
Re: Files 15 mins older than sysdate
Anyway, once I've got this fixed and have installed the later version of Perl, I'll try again.