代码之家  ›  专栏  ›  技术社区  ›  larrey

C-shell:查找文件超过12小时

  •  0
  • larrey  · 技术社区  · 7 年前

    我正在使用solaris,我需要找到超过12个小时的文件。 在solaris中,没有-mmin函数。所以,我要做的是:

    set timer = "/admin/timer.txt"
    echo date > $timer
    
    find . -type ! newer  $timer
    

    问题是,我需要每1小时运行一次脚本,但我找不到一种方法。 有什么建议吗?

    1 回复  |  直到 7 年前
        1
  •  0
  •   William Pursell    7 年前

    now=$(perl -e 'print time')
    find . -exec sh -c 'expr $1 - $(stat -f %m "$2" ) \< 43200 > /dev/null' _ $now {}  \; -print