Resetting file timestamps based on file name

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

Resetting file timestamps based on file name

Postby joe » Sun Jan 20, 2008 10:41 pm

Hello all and first I ought to say: what a great tool!

I have done some searching but have not found this asked before.

I wonder if it's possible either:
- to set the timestamp of a file based on characters in the file name
... so e.g. Recording 1-20080120-1945.mp3 gets the timestamp 2008-01-20 19:45. Obviously this would need some pattern matching to identify the required timestamp;
- or to set the timestamp based on another file
... so e.g. Recording 1.mp3 gets the timestamp of file Recording 1.amr. This would need a rule for finding the other file (which would be different for each file in the bulk rename operation) - and this rule need not be the same as the renaming rules.

The reason for this (at the moment - I'm sure there are other needs) is that I have some conversion utilities that do not preserve file timestamps, but I want them preserved. It's easy enough to rename to include the timestamp before converting, but I can't see any way of resetting it afterwards.

Thanks!
Joe
joe
 
Posts: 1
Joined: Sun Jan 20, 2008 10:21 pm

Re: Resetting file timestamps based on file name

Postby Admin » Mon Jan 21, 2008 8:54 am

Hi Joe,

Unfortunately this isn't something that BRU supports. BRU allows you to change the timestamp in a number of ways, but this isn't one of them.

Technically, it would be possible to incorporate something like this into BRU, as the "Date taken" value in a picture file is held as a character string, and I then convert that to a date. However It's not something I would incorporate into a general release, as I see it being of extremely specialised use.

If you want a custom built version of BRU then I can do that (you know where the website donation button is :-) ) but it would be a one-ff build, a temporary change.



Jim
Admin
Site Admin
 
Posts: 2360
Joined: Tue Mar 08, 2005 8:39 pm

Re: Resetting file timestamps based on file name

Postby jmbailey2000 » Sat Mar 15, 2008 2:32 pm

This is a feature I (and several others I know) could use. I have about 10k files I would like to convert and then after conversion, reset the date and time back to the pre-conversion date/time. I was hoping BRU could do this since I can put the date and time in the file name, just not the reverse (stamp the file date based on the file name). BRU looks great but without this capability, won't do me much good right now. Have to keep BRU handy for the future....just in case.
jmbailey2000
 
Posts: 1
Joined: Sat Mar 15, 2008 1:42 pm

Re: Resetting file timestamps based on file name

Postby Ardwych » Mon Jul 28, 2008 8:07 pm

Well, I'm afraid I support this 'reverse dating' idea, too, Jim.

What do you charge for user-sourced requests, for incorporation into the General Release builds?

I'm finding that I'm downloading files from my digital camera with Cam2PC and prepending the Taken date, then adjusting them with a photo editor - that changes the displayed date, the date modified.

Then I want them returned to the original Taken date whose data lies at the beginning of the name. In my case I could use BRU to use the Taken date again (if I can get it to work: with Ctrl-F4 it just put the dates back to 1Jan1970..) - but other people with other file types couldn't do that. (It's not there in scanned images, for instance.)

Would Regular Expressions help? Do you have such an expression handy? (Hmmm, the R in BRU is for Rename, isn't it...? But you do address dates with Ctrl-F4, though..)

The information in the filename, as Joe just illustrated, is 'more permanent' and accessible than some other attributes.
Ardwych
 
Posts: 9
Joined: Mon Jan 21, 2008 2:24 pm

Re: Resetting file timestamps based on file name

Postby Gringo » Thu Apr 01, 2010 8:56 pm

Sorry to revive this old thread, but this feature is exactly what I (and other video users) really need.

My Canon video camera creates movie files named something like this: "0001_20091104_184344" (where "20091104" is YYYYMMDD & "184344" is 6:43:44 PM). Unfortunately, my creation date gets changed when I extract the file from the memory card and copy it to my computer. I've been using BRU to manually update the creation time & date of each file, but a batch approach would save me a lot of time!

Thanks again for a great program!
Gringo
 
Posts: 1
Joined: Thu Apr 01, 2010 8:41 pm

Re: Resetting file timestamps based on file name

Postby Stefan » Thu Apr 01, 2010 10:43 pm

If some one is interested...
you can do such things for example with XYplorer from www.XYplorer.com

Gringo> "0001_20091104_184344" (where "20091104" is YYYYMMDD & "184344" is 6:43:44 PM)

1.) extract the date from base name
2.) extract time
3.) set creation date and time
Code: Select all
$date = regexreplace("<curbase>", ".+_(\d{4})(\d{2})(\d{2})_.+", "$1-$2-$3");
   $time = regexreplace("<curbase>", ".+_.+_(\d{2})(\d{2})(\d{2})", "$1:$2:$3");
   timestamp c, $date $time;

or shorter:
Code: Select all
$date = regexreplace("<curbase>", ".+_(\d{4})(\d{2})(\d{2})_(\d{2})(\d{2})(\d{2})", "$1-$2-$3 $4:$5:$6");
  timestamp c, $date;


If you want ask me there at the forum.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Resetting file timestamps based on file name

Postby Sam77 » Fri May 28, 2010 4:47 pm

I have to pitch in: I long for this feature. Explorer is a painfully slow way of doing this. The Time stamp is very helpful at times on my photos, but if I edit the file or creat a panorama of files, the time-stamp is lost.
Sam77
 
Posts: 4
Joined: Fri May 28, 2010 4:13 pm

Re: Resetting file timestamps based on file name

Postby Ardwych » Sun May 30, 2010 12:32 pm

That was a quick two years.. but in that time I believe I've perfected the time/date-naming of photos taken off my digital cameras. And the best tool I've found so far to do it with turns out to be one available free: Microsoft's Windows Live Photo Gallery.

With it you can import photos from a camera and prepend the date each photo was taken*, say 2010-05-30 Himalayan Mountains 001.jpg and place them in your folders where ever you choose. [*The date is the Exif time/date taken that cameras record. NB Keep it current!]

I use a belt-and-braces method of first choosing a Month folder, e.g. 2010-05 (C:\Users\Public\Pictures\2010-05), and then specifying that for the import. You change it once a month, at the start of each. You can specify all photos from your camera's card or choose to import just some at a time, or just new ones. You can auto-delete them upon import but I've decided to keep them all on my cards and save the cards, full. They're much cheaper than a roll of film and they're a good safety backup.

Set the 'Import to' folder as above, set Folder name as '(None)' (it's already chosen), and set File name as 'Date Taken + Name' to get the 'himalaya' structure. Choose your ticks to taste.

While that method may not be flexible enough for you - getting a good description for each photo or group of, I then use the indispensable tool Total Commander, with the Exif Tool add-on. With TC and its Multi-Rename Tool (Ctrl-M) I can change parts of files' filenames. Or, if it's a really tricky set, BRU comes in to do the job.

And what's especially good about TC with the Exif add-on is that you can rename existing camera files - retrospectively - since they'll probably contain embedded Exif data: e.g. 'Date Original' and 'Time Original'. You can create your own columns with which to view Exif data in the file manager. I haven't seen this capability in BRU; please tell me if I've missed it.

Edit1: Ahh, I reminded myself of the title of this thread and I see that I may be speaking in reverse purposes. As for resetting file timestamps - I have decided to ignore the dates and times that file managers like Windows Explorer, Xplorer2, Total Commander etc report; they're a lost cause. They're file system parameters and are as changeable as the breeze. :) I advise that you look elsewhere for timestamps that are more controllable; that's why I now rely upon filenames and Exif data.

Edit2: In conclusion, with regard to WiLiPhGallery, I find that since the one constant in human experience is time, it helps to have files stored in time-related folders - but there's more: it doesn't matter - WLPG uses that time structure as a convenience but then lets you tag photos supremely easily. Singles, multiples, drag'n'drop, include all, remove, not yet tagged, file info and photo edit, make panoramas, email resized attachments, view by tag(s), print, burn, publish, movies, etc. Indeed, you can edit or slide the times taken if it's wrong on your camera. And the tags are embedded in the files' Exif data, so you don't have to depend on the one program.
Ardwych
 
Posts: 9
Joined: Mon Jan 21, 2008 2:24 pm


Return to BRU Support