Friday, February 17, 2012

How to find the File Age and wait for that... - The UNIX and Linux Forums

How to find the File Age and wait for that... - The UNIX and Linux Forums:
"#! /bin/sh

ToM=`stat -c=%Y webtogo.cpp | awk -F"=" '{ printf $NF }'`
[ $(( `date +%s` - $ToM )) -gt 1800 ] && echo " File is older than 90 min"

ToM is Time of Modification

Vino"

Nice...
Another spin on this is that age of file in minutes is:
#!/bin/bash
for fil in $*
do
eval expr "\( $(date +%s) - $(stat -c=%Y $fil | sed 's/=//') \) / 60"
done


Cheers,

No comments:

Post a Comment