I would like to know how to read the timestamp of a given file present on
a) Unix m/c
b) FTP server
Also, how do i compare two timestamps that I have ?
A starting point in ksh with Perl:
file="/path/to/givenfile"
eval $(perl -e '
($ss,$mn,$hh,$dd,$mm,$yy,$wd,$yd,$dst)=localtime((stat("'$file'"))[9]);
printf("DATE=%04d%02d%02d\n",$yy+1900,$mm+1,$dd);
printf("TIME=%02d%02d%02d\n",$hh,$mn,$ss)')
echo "$file:"$DATE,$TIME
Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.