Solved How to create folders from batch file using date taken

April 8, 2012 at 20:17:34
Specs: Windows Server 2003 R2, Athlon XP dual core
I am looking to write a batch file that I can execute on all files within a folder, which will create subfolders from the "date taken" property of each file (some of these files are photos) in the format "yyyy-mm-dd". In addition, (else statement?) I would like any file which does not have a "date taken" property (video files) to have a subfolder created matching the "date created" property. Lastly, I would like the script to move the file in question to its newly created subfolder.

I have tried some variations of the FOR command (found in other people's questions) with limited success, but I have been able to create subfolders as "mm\yyyy\mm\dd" which nests a lot of folders instead of "yyyy-mm-dd":

for /D %%Q IN (*.*) DO (
set FILETIME=%%~tQ
MD "!FILETIME:~0,10!"
)


See More: How to create folders from batch file using date taken

Report •


#1
April 9, 2012 at 10:39:00
By "date taken" do you mean the date the file was created on the file system? Or the EXIF data in the photograph?

Tony


Report •

#2
April 9, 2012 at 11:06:50
Not familiar with the EXIF data, but I assume this is where Explorer gets this information from(?). It is separate from the file creation, last accessed and last modified properties.

In Explorer (using Windows 7) I am able to set the view to "details", and then right click the headings and select "more", then set the check-box next to "Date taken". This then allows me to view the "Date taken" property, as well as sort by this property.


Report •

#3
April 10, 2012 at 05:51:31
✔ Best Answer
There is no way to read that file property using wmic or anything that I am aware of. Try this:

How Can I Add the Date a Picture Was Taken to the File Names of My Digital Photos? May get you started.

Tony


Report •

Related Solutions

#4
April 27, 2012 at 15:35:18
Thanks for the link. The script in your link locates the properties via desktop search, so I guess it makes sense that a batch file (and DOS commands in general) cannot access this data. I was able to modify it to do some of what i wanted.

The down side, of course, is that i need to learn more VBS where I could have done the rest of what I wanted (if there is no date taken, use the file created property to sort) in a batch file.

Thanks for directing me to where i needed to be!


Report •

Ask Question