I need a linux bash script to know the time in seconds when a particular folder was modified.
Can someone please help me?
My current script below is getting the current time stamp and the last time the folder was modified, but i do not know how to proceed.
[root@cgf01 log]# more CheckLastCdr.sh
#get current timestamp
current_time=`date`
#get last CDR timestamp
last_cdr_time=`find /tmp/log/ -exec stat \{} --printf="%y\n" \; | sort -n -r | head -1`
echo $current_time
echo $last_cdr_time
when i run this script i am getting the following:
[root@cgf01 log]# ./CheckLastCdr.sh
./CheckLastCdr.sh: line 6: 2011-04-05: command not found
Tue Apr 5 16:19:31 CEST 2011
2011-04-05 16:14:33.000000000 +0200
thanks in advance
If you want the number of seconds ago: