Move images and videos into directories in another root folder by year/month

Started by ericnotthered, July 16, 2022, 01:41:43 PM

Previous topic - Next topic

ericnotthered

I've been struggling to move files from the current directory into a year/month structure based on the CreateDate under a different root folder.  The files are mostly in mp4 format.

I can successfully move these files to subfolders of the current directory by using the command: 
exiftool -d %Y/%m "-directory<CreateDate" .

They end up in YYYY/MM directories within the current directory as expected.  However, I wish to move the files to subfolders of a different root folder:  "g:\sorted"

I tried following the advice the advice in these posts: 
https://exiftool.org/forum/index.php?topic=12577.0
https://exiftool.org/forum/index.php?topic=11887.0

From that, I derived the command:
exiftool -d %Y/%m "-directory<g:/sorted/$CreateDate" .

This gives me these warnings for each of the files, and nothing is moved:

QuoteWarning: No writable tags set from VID_20210609_072910.mp4
Warning: Invalid tag name 'g:/sorted/'. Use '=' not '<' to assign a tag value - VID_20210609_072910.mp4

If I change the '<' to a '=' like this:
exiftool -d %Y/%m "-directory=G:/sorted/$CreateDate" .

exiftool moves all of the files to the folder "g:\sorted" (no sub-directories are created).

I'm stumped.  I'd greatly appreciate any pointers. 

I'm using exiftool 12.4.3.0. on Windows 11.

- Eric




ericnotthered

I figured it out from another post:

exiftool -d "g:/sorted/%Y/%m" "-directory<CreateDate" .

I'll leave this hear in case someone else runs into the same challenge.

StarGeek

Were you using PowerShell or CMD.

In PowerShell, you probably have to use single quotes around commands that have a dollar sign in them, otherwise it will think it's a shell variable.  The highlighting in the command will tell you when PS thinks something is different.  Notice here how $CreateDate has different highlighting

* 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).