You are here

Touch Time

Error message

Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in drupal_strip_dangerous_protocols() (line 1458 of /home2/crephoto/public_html/techblog/includes/common.inc).

The touch command allows custom modification of file access and modification times. I can never remember the syntax, so here it is. Here's the format:

$ touch -t YYYYDDDDHHMM

Where "YYYY" is the four digit year, "DDDD" is the two digit month and two-digit day of month, and so on. For example, to set the modification date to June 30, 2011 at 2:16 pm, you would enter:

$ touch -t 201106301416

Note that 1416 is the 24-hour notation for 2:16 pm.

If you want to set the modification time of a file to match that of another file, use:

$ touch -r <from_file> <to_file>