How to modify a timestamp of a file

A file can have two timestamp attributes: accessed and modified. You can set them individually, or both to the same time.

If the  accessed and modified time should be the same:

$ touch -a -m -t 201512180130.09 fileName.ext

Where:

-a = accessed
-m = modified
-t = timestamp - use [[CC]YY]MMDDhhmm[.ss] time format

If you wish to use NOW just drop the -t and the timestamp.

To verify they are all the same: stat fileName.ext

See: touch man

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: