- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How old is a file ?
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-03-2006 08:53 AM
02-03-2006 08:53 AM
How old is a file ?
How to show , how "old" is a file is in minutes.
Thanks for your Answers ,
Regards ..BL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2006 08:57 AM
02-03-2006 08:57 AM
Re: How old is a file ?
# perl -le '$t=(stat $ARGV[0])[9];print time()-$t' filename
...gives a file age in seconds
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2006 09:00 AM
02-03-2006 09:00 AM
Re: How old is a file ?
Oh, sorry, if you want minutes:
# perl -wle '$t=(stat $ARGV[0])[9];printf "%d\n",((time()-$t)/60)' filename
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2006 09:02 AM
02-03-2006 09:02 AM
Re: How old is a file ?
fileage.pl -S myfile
will return the number of seconds since myfile was modified; divide by 60 and you havbe minutes. Invokew as fileage.pl without arguments for a usage display.
This script makes use of Perl's stat function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2006 03:37 AM
02-04-2006 03:37 AM
Re: How old is a file ?
The same caveat about creation time exists of course. Thus it is missing from the list:
-M Script start time minus file modification time, in days.
-A Same for access time.
-C Same for inode change time (Unix, may differ for other platforms)
Sample usage to print file last modify time in minutes:
perl -e "print ((-M shift @ARGV) * 24 * 60)" file.dat
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2006 04:05 AM
02-04-2006 04:05 AM
Re: How old is a file ?
Rgds...Geoff