Possible to change create date based on folder?

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Possible to change create date based on folder?

Postby jnix » Sun Jan 28, 2018 9:06 pm

Hi,

I have many files which have all got a create date of when they were moved to my PC. But they are in the folder structure of year > month eg 2006>10-October and 2006>11-November

Is it possible to change the "create date" of multiple jpgs according to the folder they are in? I know how to it manually, but there are lots of folders!
Any advice appreciated
jnix
 
Posts: 1
Joined: Sun Jan 28, 2018 9:05 pm

Re: Possible to change create date based on folder?

Postby therube » Mon Jan 29, 2018 2:33 pm

So you want to change the create date, but does it matter if the modified date is also changed?

If not, "touch" can take a reference file (or directory) date & use that as the basis to change files date.

Something like:
Code: Select all
touch.exe  -r  parentdirname  filename(s)


Code: Select all
touch  -r  C:\TMP\2006-10-October\   *.jpg


NOTE: This assumes that the directory (not directory name) is dated as you want.

And then you could automate things using a batch file, & set the batch file to run as a right-click SendTo item...
Such that from within your file manager you right-click a file, it pulls its parent directory & uses that as a parameter to touch.
Something like (pseudo-code): touch.exe -r %~p1 *.jpg
Which you could then expand to loop through a directory...


For changing directory dates to the dates of files within, see Nirsoft's FolderTimeUpdate.


Code: Select all
Usage: touch [OPTION]... FILE...
Update the access and modification times of each FILE to the current time.

Mandatory arguments to long options are mandatory for short options too.
  -a                     change only the access time
  -c, --no-create        do not create any files
  -d, --date=STRING      parse STRING and use it instead of current time
  -f                     (ignored)
  -m                     change only the modification time
  -r, --reference=FILE   use this file's times instead of current time
  -t STAMP               use [[CC]YY]MMDDhhmm[.ss] instead of current time
  --time=WORD            change the specified time:
                           WORD is access, atime, or use: equivalent to -a
                           WORD is modify or mtime: equivalent to -m
      --help     display this help and exit
      --version  output version information and exit

Note that the -d and -t options accept different time-date formats.

Report bugs to <bug-coreutils@gnu.org>.



touch, can be found in CoreUtils ("Binary" zip).
Also required would be the "Dependencies" zip.
(Copy touch.exe & the two .dll from "dependencies" & put them in your PATH. [I've never used the "setup" files.])
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm


Return to BRU Support