Changing the modification time and date of a file

When copying from a non-POSIX filesystem, I always forget that the file modification time and date will be lost, and I have to restore it manually. Fortunately it's easy to do. …

touch filename.txt

The above changes the modification time and date to this moment.

touch -d "2010-11-01 17:53:23" filename.txt

The above changes the modification time and date to (for example) 5:53 PM plus 23 seconds, November 1, 2010.

Advertisements

About Warren Post

So far: Customer support guy, jungle guide, IT consultant, beach bum, entrepreneur, teacher, diplomat, over-enthusiastic cyclist. Tomorrow: who knows?
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

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