Help renaming many images by creation date - not a programmer but trying

Started by LP Canada, January 10, 2017, 05:01:38 PM

Previous topic - Next topic

LP Canada

Hello - I copied all of my videos from my iPhone to my home computer.  All video dates were correct. Then I reorganized all the videos into folders by date range and now all of the videos in each folder are labelled by a different date than the actual date created.  For example, I have one folder with videos from Aug 2016 to Jan 2017.  They are all now labelled as Jan 2017.  I understand that windows dating is the file modifications, not the actual date of the video.  But now, I have lost my ability to sort them by when they were actually taken. I have read that ExifTool can do this for me but by no means am I a programmer. I have the utility in my computer as exiftool.exe so I can use the command line. I created a copy of one my image folders as a test and was successfully able to read the metadata for each of the 30 videos in the folder (though I had to do them one by one - when I tried to do them as a total folder, the read info only gave me the metadata of last three videos in the group).  All of them showed me when the video was actually created (QuickTime 7.7.9 doesn't give me any date info). I then reviewed a few tutorials (all above my head) and also tried using this code off of Polaine.com (exiftool '-FileModifyDate<TrackCreateDate' '-FileName<TrackCreateDate' -d %Y-%m-%d_%H.%M.%S.%%e - exactly like this - not sure if I had to do anything to it - I thought it might just naturally pick up the created date on its own?) to save them all with a new name by actual creation date. I get nothing but error messages - not surprising since I have no idea what I am doing.  Are there any very patient individuals out there that could take a few moments to walk me through this in pseudo layman terms?  Thanks so much.

UPDATE: I just tried a recommendation found in the newbie board - A copy of each image was indeed created in the image folder but the date it was assigned in the date column of the folder was today's date, not the actual date the video was taken (which is correctly listed in the metadata when I run exiftool for each image). It's a start though - at least something happened when I did this. As each image copy was created, the following showed in the commands for each image: Warning: Invalid date/time <use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM:Z1> in File:FileModifyDate <PrintConVInv> - ./IMG_3195.MOV.  The copy created could also not be opened.


StarGeek

Your command looks good except for one thing.  If you're on Windows, change the single quotes into double quotes.
exiftool "-FileModifyDate<TrackCreateDate" "-FileName<TrackCreateDate" -d %Y-%m-%d_%H.%M.%S.%%e FileOrDir

This may work if there is a TrackCreateDate tag in the file.  If it doesn't, then you may want to look to see if there's a different tag you can use.  Type this to take a look at all the time tags:
exiftool -time:all -G1 -a -s FileOrDir

You can then pick which tag to use if TrackCreateDate doesn't exist.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

LP Canada

Thank you very much for responding.  At the command prompt, I changed the directory (cd) to the folder that has the 30 pictures. Then beside that at the prompt, I copied and pasted exactly what you gave me beside the prompt. It gave me an error message.  I checked the metadata and each one does have a track create date. Should I have copied your command exactly with the % marks etc? At the end of the command you typed FileOrDir.  If I am doing the whole folder, do I need to change that?  The error message I get is copied below.  I know I have done something wrong.  Thanks so much.

C:\Users\Leighanne>cd "C:\Users\Leighanne\Desktop\Videos May 16-19 2016 - Copy"

C:\Users\Leighanne\Desktop\Videos May 16-19 2016 - Copy>exiftool "-FileModifyDat
e<TrackCreateDate" "-FileName<TrackCreateDate" -d %Y-%m-%d_%H.%M.%S.%%e FileOrDi
r
Warning: Error opening file - FileOrDir
Error: File not found - FileOrDir
    0 image files updated
    1 files weren't updated due to errors

C:\Users\Leighanne\Desktop\Videos May 16-19 2016 - Copy>exiftool "-FileModifyDat
e<TrackCreateDate" "-FileName<TrackCreateDate" -d %Y-%m-%d_%H.%M.%S.%%e Dir
Warning: Error opening file - Dir
Error: File not found - Dir
    0 image files updated
    1 files weren't updated due to errors

C:\Users\Leighanne\Desktop\Videos May 16-19 2016 - Copy>

Phil Harvey

Hi Leighanne,

Instead of typing FileOrDir or Dir literally, drag and drop the file or folder that you want processed onto the cmd window.  Either that or type the directory name.  If you already cd'd into the directory, then a simple "." will suffice ("." represents the current directory):

exiftool "-FileModifyDate<TrackCreateDate" "-FileName<TrackCreateDate" -d %Y-%m-%d_%H.%M.%S.%%e .

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

LP Canada

WOW!!!!!!!! Phil Harvey and StarGeek - thank you both so much for your help.  Pure magic!! It worked and renamed all 30 of my videos with the date they were each created.  Now, to change the rest of my files.  This program is quite literally a saviour! Again, thank you both so much for reading my plea for help and your fantastic advice.

LP Canada

Hi Phil

I am using the two formulas you gave me with great success.  I am now going through my thousands of images and videos on my hard drive to clean them up, remove duplicates etc.  Part of my problem is that I have many duplicate file names from my camera numbering system, but the images themselves are different.  I want to rename all of my images and videos by date created to make clean up easier.

The two formulas you gave me work most of the time.  Sometimes though, I will have some images and videos that resist the name change - not sure why - guessing there is something different in their metadata and I do not have anywhere near enough programming knowledge to figure out what that is.  Sometimes it is only a few images so I am not too bothered by it.  However, when it is a whole file of images or videos, I would like to try to figure out a workaround.

For example, I have just now come across a whole file full of videos that will not change with the two formulas below.  I have looked at the metadata and there is no 'track create date' or 'create date' verbage so I am assuming that is why.  There is a Date Time Original which I have tried to put into the formula, but not having any luck.  I have copied the two formulas I am using and also the metadata for one of the videos.  Any hints or quick lessons you can give me to make subtle changes to the formula when I run into snags such as this (i.e. what to look for in the metadata and how to write it into the formula).

exiftool "-FileModifyDate<CreateDate" "-FileName<CreateDate" -d %Y-%m-%d_%H.%M.%S.%%e .

exiftool "-FileModifyDate<TrackCreateDate" "-FileName<TrackCreateDate" -d %Y-%m-%d_%H.%M.%S.%%e .

I don't know how to copy the cmd screen data into this reply box so will simply type all the metadata listed:

File Name                                     001.MOV
TS
Directory                                     C:/Users/LP/Pictures/2014-09-02 videos
File Size                                       17 MB
File Modification Date/Time          2012:12:31 22:50::04-5:00
File Access Date/Time                  2012:12:31 22:50::04-5:00
File Creation Date/Time                2012:12:31 22:50::04-5:00
File Permissions
File Type                                       M2TS
File Type Extension                       mts
MIME Type                                   video/m2ts
Video Stream Type
Audio Stream Type
Audio Bitrate
Surround Mode
Audio Channels
Image Width
Image Height
Date/Time Original                         2012:12:31 22:50::04-5:00
Aperture Setting
Gain
Exposure Program
While Balance
Focus
Image Stabilization
Exposure Time
F Number
Make                                               Sony
Camera Model Name                       DSC-HX30V
Audio Sample Rate
Duration
Aperture
Image Size
Megapixels
Shutter Speed

Thanks very much Phil (or anyone else kind enough to answer).

LP Canada

Phil Harvey

That's a lot of typing.

I'm assuming the double colon after the minutes in all of the dates is a cut-n-paste typo.  If the DateTimeOriginal is formatted properly, then adding it to your command should work.  And combining your commands, this command should work for any file that contains any of the 3 date/time tags (provided there aren't two files with the same date):

exiftool "-FileModifyDate<TrackCreateDate" "-FileModifyDate<CreateDate" "-FileModifyDate<DateTimeOriginal" "-FileName<TrackCreateDate" "-FileName<CreateDate" "-FileName<DateTimeOriginal" -d %Y-%m-%d_%H.%M.%S.%%e .

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Quote from: LP Canada on June 05, 2017, 12:44:02 AM
I don't know how to copy the cmd screen data into this reply box so will simply type all the metadata listed:

In CMD, you can click and highlight the text and then press ENTER.  In newer Windows (10 and maybe 8?), you can use Control+C to copy to the clipboard.  Also, if you're using Windows 7 or newer, you can add |Clip to the end of a command to copy the output to the clipboard e.g. exiftool 001.MOV |clip.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype