- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: How to get a file's year of last modification ...
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
тАО10-19-2005 09:22 PM
тАО10-19-2005 09:22 PM
How to get a file's year of last modification by SHELL?
Thanks.
- Tags:
- ls.cat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2005 09:24 PM
тАО10-19-2005 09:24 PM
Re: How to get a file's year of last modification by SHELL?
Mark Syder (like the drink but spelt different)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2005 09:30 PM
тАО10-19-2005 09:30 PM
Re: How to get a file's year of last modification by SHELL?
Modification Time
The last time the file was modified. If the last modification occurred more than six months in the past, the date and year are displayed. Otherwise, the time of day is shown.
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2005 09:45 PM
тАО10-19-2005 09:45 PM
Re: How to get a file's year of last modification by SHELL?
To work around this,
1) find
It will update the file with time details to that you can old file informations from this. :) Just select required directory with
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2005 09:59 PM
тАО10-19-2005 09:59 PM
Re: How to get a file's year of last modification by SHELL?
cc getmtime.c -ogetmtime
Then run it as
getmtime file
I'm sure you can change it to suit your needs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2005 10:22 PM
тАО10-19-2005 10:22 PM
Re: How to get a file's year of last modification by SHELL?
You can use perl script also:
#!/usr/local/bin/perl
use File::stat;
$file = "test.txt";
$file_stat = stat($file) or die "No $file: $!";
$original_time = $file_stat -> mtime;
$file_stat = stat($file);
$new_time = scalar localtime $file_stat -> mtime;
print "Time: " . $new_time . "\n";
Thanks.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2005 10:28 PM
тАО10-19-2005 10:28 PM
Re: How to get a file's year of last modification by SHELL?
It is great. Working like a charm. Tested with
# touch -t 8907140000 file
# ls -l file
-rw-r--r-- 1 root root 0 Jul 14 1989 file
# perl tst.pl
Time: Fri Jul 14 00:00:00 1989
# touch -t 8907140030 file
# perl tst.pl
Time: Fri Jul 14 00:30:00 1989
Keep sharing.
P.S: Assing 0 points.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2005 10:30 PM
тАО10-19-2005 10:30 PM
Re: How to get a file's year of last modification by SHELL?
To use durai's solution, you have to have File/stat.pm (perl module). Check stat.pm in your system. If you are having then good else download File/stat.pm and use it.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2005 10:57 PM
тАО10-19-2005 10:57 PM
Re: How to get a file's year of last modification by SHELL?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2005 11:33 PM
тАО10-19-2005 11:33 PM
Re: How to get a file's year of last modification by SHELL?
Use perl script with recrusive find.pm to achive this.
hth.