【发布时间】:2011-04-05 14:21:25
【问题描述】:
我需要一个 linux bash 脚本来了解修改特定文件夹的时间(以秒为单位)。 有人可以帮帮我吗?
下面我当前的脚本正在获取当前时间戳和上次修改文件夹的时间,但我不知道如何继续。
[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
当我运行这个脚本时,我得到以下信息:
[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
提前致谢
【问题讨论】: