12

In Windows, I am used to modify directory dates, eg. of directories containing photos according the date when the first photo was taken; and then display a list of the directories sorted by the dates. In Ubuntu, Krusader can display the directories this way. I need to change the date (the "date of modifying") of a directory after I fill it with eg. the photos. How should I change it? Thanks

0

2 Answers 2

11

You can use touch command with -t option. This is from man touch:

NAME
       touch - change file timestamps

SYNOPSIS
       touch [OPTION]... FILE...

DESCRIPTION
       Update  the  access  and modification times of each FILE to the current
       time.
[...]

-t STAMP
              use [[CC]YY]MMDDhhmm[.ss] instead of current time

An example:

touch -t 1312031429.30 /path/to/directory

will change the date modified for directory to 2013-12-03 14:29:30.

1
  • It's useful to note that you must use the -t option here. The -d flag present on newer versions of touch does not modify the mtime of a directory, just files.
    – Foosh
    Nov 28, 2018 at 16:01
0

Don't. It will just get changed as soon as anything in the directory changes anyhow ( like when a thumbnail is generated ). Instead, rename the directory so the date you want is in the name.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .