View Single Post
Posts: 118 | Thanked: 26 times | Joined on Feb 2008
#3
Ok, seems like "perl" is installed by default...

sooo.... why don't you use perl? It has a built-in stat command and should run faster for any reasonably sized script.

However, if you really want to avoid perl, you can use this in your shell script:

Code:
filename=foo
date=`perl -e 'print ((stat($ARGV[0]))[9] . "\n")' $filename`
(this will give you seconds since epoch)

for more friendly output:

Code:
filename=foo
date=`perl -e 'print (localtime((stat($ARGV[0]))[9]) . "\n")' $filename`

Hope that helps.

Martin
 

The Following User Says Thank You to m_stolle For This Useful Post: