For my picture collection I want to have all pictures in a folder automatically sorted into folders by date. Luckily the files are already named after the timestamp:
- 2012-07-15 12.21.06.jpg
- 2012-07-15 12.21.26.jpg
- 2012-07-16 17.12.50.jpg
In this example the two first files should end up in a folder 2012-07-15, the third one in 2012-07-16. I've tried and googled, all I can find is this:
for %%a in (*.jpg) do (
md "%%~na" 2>nul
move "%%a" "%%~na"
)
But that makes a folder for every file name. I thought of having a variable that has the ten first chars, but get totally confused and frustrated with variable declaration and use in dos. Can anyone help?