Time stamp of a file

Using Bash shell script how to test if the file has been modified by checking the time stamp of the file.

Thanks.

Comments

  • : Using Bash shell script how to test if the file has been modified by checking the time stamp of the file.
    :
    : Thanks.
    :

    to get just the timestamp use
    [code]
    /bin/ls -l $1 | cut -b44-55
    [/code]

    to test for changes you can try something like:
    [code]
    #!/bin/sh

    if test -N $1; then
    echo "exists and has changed since read"
    :
    else
    if test -a $1; then
    echo "not changed"
    :
    else
    echo "not existing"
    fi
    fi
    [/code]
    to test against the last read time. afaik the creation time isn't stored.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion