News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Newb Question: Sorting Photos by Time Taken into Folders

Started by JordanMowbray, June 03, 2021, 06:17:55 PM

Previous topic - Next topic

JordanMowbray

I am newer than a Newb to exiftool. I have some trail camera photos that I am compiling into timelapse from many days. I want to sort out the photos taken during the dark by using exiftool to sort the photos by time taken into folders and ignore date. This will allow me to delete the folders of photos taken during night. This is the command line I tried:

exiftool '-Directory<${DateTimeOriginal}' '-d %H' C:\Users\Jordan\Desktop\Timelapse\1 >C:\Users\Jordan\Desktop\Timelapse\1\Sort

I am getting an error that "The system cannot find the file specified".

Where am I going wrong and can you see anything else wrong in the code to do this?

StarGeek

If you're using CMD, you want to use double quotes instead of single quotes.  PowerShell would use single quotes.

Quote from: JordanMowbray on June 03, 2021, 06:17:55 PM
exiftool '-Directory<${DateTimeOriginal}' '-d %H' C:\Users\Jordan\Desktop\Timelapse\1 >C:\Users\Jordan\Desktop\Timelapse\1\Sort

I am getting an error that "The system cannot find the file specified".

You have quotes around the -d (-dateFormat) option and its argument.  These are two separate parameters.  Also you don't need to use the $ when there isn't multiple tags being copied from, but that's minor and should stop anything.

So on CMD
exiftool "-Directory<DateTimeOriginal" -d %H C:\Users\Jordan\Desktop\Timelapse\1
and PS
exiftool '-Directory<DateTimeOriginal' -d %H C:\Users\Jordan\Desktop\Timelapse\1

Also take note that both these commands create new directories in your current directory.  So if you haven't CDed to the directory that contains the files, then you might end up copying them to the wrong location.  For example, when I start up Powershell, the current directory is C:\Windows\System32\WindowsPowerShell\v1.0 and running this command without changing the directory would move all the files into the Powershell directory.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

JordanMowbray

Thanks StarGeek. I appreciate your patience as I will be doing baby steps here. When I launch my cmd prompt window it is C:\Windows\system32
The jpeg files are located on my C drive desktop. I see you dropped off the >C:\Users\Jordan\Desktop\Timelapse\1\Sort part. I thought this was needed to tell where to sort the files into?

Anyways when I run : C:\WINDOWS\system32>exiftool "-Directory<DateTimeOriginal" -d %H C:\Users\Jordan\Desktop\Timelapse\1 >C:\Users\Jordan\Desktop\Timelapse\1\Sort     
I am getting "'exiftool' is not recognized as an internal or external command,
operable program or batch file." message now.

JordanMowbray


JordanMowbray

I also tried: cd C:\Users\Jordan\Desktop to switch the directory in case it could not find:

C:\Users\Jordan>cd C:\Users\Jordan\Desktop

C:\Users\Jordan\Desktop>exiftool "-Directory<DateTimeOriginal" -d %H C:\Users\Jordan\Desktop\Timelapse\1 >C:\Users\Jordan\Desktop\Timelapse\1\Sort
'exiftool' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Jordan\Desktop>

JordanMowbray

Powershell and cmd prompt screen shot attached. Ive never worked with powershell.

StarGeek

Quote from: JordanMowbray on June 03, 2021, 06:45:26 PM
When I launch my cmd prompt window it is C:\Windows\system32

So unless you CD to a different directory, all your images will be moved into subdirectories of C:\Windows\system32.

QuoteI see you dropped off the >C:\Users\Jordan\Desktop\Timelapse\1\Sort part. I thought this was needed to tell where to sort the files into?

No, the Directory tag tells exiftool where to move the files into. See Writing "FileName" and "Directory" tags.  The >C:\Users\Jordan\Desktop\Timelapse\1\Sort part is telling the CMD window  (not exiftool) to redirect any output exiftool makes into a file named "sort"

QuoteAnyways when I run : C:\WINDOWS\system32>exiftool "-Directory<DateTimeOriginal" -d %H C:\Users\Jordan\Desktop\Timelapse\1 >C:\Users\Jordan\Desktop\Timelapse\1\Sort     
I am getting "'exiftool' is not recognized as an internal or external command,
operable program or batch file." message now.

Exiftool is not part of the current PATH variable.  PATH is a special Windows variable that tells the command line where to look for programs to run.  You can see all the directories in the path by typing echo %path%.  You either need to put exiftool into one of those directories, add the directory with exiftool to PATH, or use the full path name to run exiftool.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

StarGeek

You can drag/drop files onto the CMD window to get the full file path. 

Example


If there is a space in the path, you do need to put quotes around it.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

JordanMowbray

I got the same error again. I tried adding it to my PATH as well as inserting the program directly like in the GIF and still get the same thing. Any other suggestions on what im doing wrong? Attached is the path I added to my user profile.  Heres a video of what im doing as well:
https://www.youtube.com/watch?v=OwNWEUpsjcM

StarGeek

The PATH should only include the directory path, not the program name.  So you should only add C:\Users\Jordan\Desktop

Also, you skipped Step 3 on the Windows Install instructions.  Typing exiftool won't run when the name is still exiftool(-k)  Rename it to remove the (-k).

Windows CMD acts weird when there is parenthesis in the name. Removing it should help.

But understand that the command you have will put all Hour directories on the desktop.  If you want them to stay in the Timelapse directory, that will need to be added in.  Try adding the full path to the destination as part of the -d option.  Something like this
exiftool "-Directory<DateTimeOriginal" -d "C:\Users\Jordan\Desktop\Timelapse\1\%H" C:\Users\Jordan\Desktop\Timelapse\1
Will create all the Hour directories in the "Timelapse\1\" directory.  Edit as needed.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

JordanMowbray

Thank you so so much! It finally worked! I did get a bunch of errors for each file but im guessing these must be within another field in the exif data. None the less it did not affect it from putting each photo in the corresponding hour folder:
Warning: [minor] Unrecognized MakerNotes - C:/Users/Jordan/Desktop/Timelapse/1/DSCF0688.JPG
Warning: [minor] Unrecognized MakerNotes - C:/Users/Jordan/Desktop/Timelapse/1/DSCF0689.JPG
Warning: [minor] Unrecognized MakerNotes - C:/Users/Jordan/Desktop/Timelapse/1/DSCF0690.JPG

StarGeek

Unrecognized MakerNotes just means that exiftool cannot recognize the proprietary MakerNotes that are specific to the camera that created the file.  This can be because Phil has never seen a sample of that camera or it can mean that some program that was not aware of the MakerNotes and did not properly parse the file structure has corrupted them.

Either way, it doesn't affect the image.  It just means the MakerNotes data isn't accessible.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).