Move and create dirs

Started by Lectrician, October 23, 2011, 06:23:57 AM

Previous topic - Next topic

Lectrician

I currently have some software which uses WiFi to sync all my photos from my iPhone to my server which works great, but I end up with a single directory full of images.

I found this software and it appears it should be able to help me, although I am struggling to get it to do exactly what I want!

I am running it through CMD and would like to create a batch file which will run under scheduled tasks.

I would like it to read all images in the base dir and move them into folders like Oct_2011, Oct_2012 (or 10_2011, 10_2012).

Is this possible with a single command?

Thanks for any help!

Phil Harvey

To do this, just copy any date/time tag to the "Directory" tag with the desired date/time formatting.

See the application documentation renaming examples for some examples, and the writing "FileName" and "Directory" tags documentation for more details.

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

Lectrician

Sorry for not thankyou earlier, I have only just had chance to revisit this, and will be trying again soon!

Thanks for the pointers.

Lectrician

#3
Quick update.  I have it working.  After re-reading the info I realised I needed to alter the variables when using it through a batch file.

Here is what I am using:


##start batch file##
set mbasedir="D:/Users Shared Folders/Martin/My Pictures/iPhone"
set kbasedir="D:/Users Shared Folders/Katie/My Pictures/iPhone Photos"

exiftool -d %mbasedir%/%%Y/(%%m)-%%b "-directory<CreateDate" %mbasedir%
exiftool -d %mbasedir%/%%Y/(%%m)-%%b "-directory<FileModifyDate" %mbasedir%

exiftool -d %kbasedir%/%%Y/(%%m)-%%b "-directory<CreateDate" %kbasedir%
exiftool -d %kbasedir%/%%Y/(%%m)-%%b "-directory<FileModifyDate" %kbasedir%
##end batch file##



It will move any images from the base director into folders like:
\2010\(01)-Jan
\2010\(05)-May
\2011\(09)-Sep
\2011\(12)-Dec

I chose to have "(12)-Dec" to allow quick find by visual month, but the numbers in brackets put the folders in month order (Jan, Feb, March etc), rather than true alphabetically which would end up with Apr, Aug, Dec, Nov, which is not helpful!

I have run both CreateDate and FileModifyDate to ensure any images without exif data (for whatever reason) are moved too.

I would like to get this work with my iPhone videos too (*.MOV), but do not think I can do this??


Phil Harvey

#4
Looks good.  If you specify MOV it will work for them too (a-la FAQ 16).  Also, you can combine this into a single command.  When you copy different tags to Directory, the last one takes precedence, so we do CreateDate after FileModifyDate:

##start batch file##
set mbasedir="D:/Users Shared Folders/Martin/My Pictures/iPhone"
set kbasedir="D:/Users Shared Folders/Katie/My Pictures/iPhone Photos"

exiftool -d %%%%d%%Y/(%%m)-%%b "-directory<FileModifyDate" "-directory<CreateDate" -ext jpg -ext mov %mbasedir% %kbasedir%

##end batch file##


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

Lectrician

Thats great, thank you, it works perfectly!  I have also added a "-ext png" for screen shots stored on the iPhone.

I am a little confused by the bit in red below!  I can see it works perfectly, but can't quite see how/what this bit is?

exiftool -d %%%%d%%Y/(%%m)-%%b "-directory<FileModifyDate" "-directory<CreateDate" -ext jpg -ext mov %mbasedir% %kbasedir%

Phil Harvey

Quote from: Lectrician on October 31, 2011, 05:17:33 PM
I am a little confused by the bit in red below!  I can see it works perfectly, but can't quite see how/what this bit is?

exiftool -d %%%%d%%Y/(%%m)-%%b "-directory<FileModifyDate" "-directory<CreateDate" -ext jpg -ext mov %mbasedir% %kbasedir%

You'll find all of the details in the documentation I referenced, but the bottom line is that this represents the directory of the source file.

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