Agnus Dei (jackal) wrote,
Agnus Dei
jackal

How to see how old a file is (using bash)

#!/bin/bash

FILE="/tmp/foo.sh"

NOWTIME=`date +%s`
FILELASTMODTIME=`stat -L --format %Y $FILE`
SECONDSOLD=`echo $(( $NOWTIME - $FILELASTMODTIME ))`
echo $FILE is $SECONDSOLD seconds old
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 0 comments