I did try:
If fso.GetExtensionName(fs) = "jpg" or "JPG" Then
but it didnt recognise the string JPG.....
That isn't proper syntax. the "Or" operator only works on Booleans or numeric variables.
in order for it to work here you'd need to use:
If fso.GetExtensionName(fs) = "jpg" or fso.GetExtensionName(fs)="JPG" Then
However, it still wouldn't work for mixed case, like jPg or Jpg or JPg, etc.
using lcase or ucase to convert the case before comparison, however, fixes that.
*Note:
Previously, me and Geek-9pm, another member, got in a rather heated debate with regards to this particular usage. my stance was that it was best to use StrComp() to compare strings,rather then case conversions. this was based on the fact that StrComp() would recognize combined glyphs such as the combined "AE" character properly being matched to the actual two characters, AE.
However, it would appear, from what I've read in the meantime regarding StrComp, that while this would work, it is slower (another incorrect contention I held was that the StrComp() method was faster). StrComp() is designed for comparing strings for sorting algorithms; this is why it returns a value indicating the sort order of the two items.
Therefore, if geek-9pm is reading this, I was WRONG
This could work...not quite sure...it depends on the camera.
@echo off
setlocal enabledelayedexpansion
for /f "skip=5 tokens=1,5" %%A in ('dir /t:c *.jpg') do (
echo Date --- %%A
echo File --- %%B
if not "%%B"=="" if not "%%B"=="free" (
set filedate=%%A
set filedate=!filedate:/=-!
if not exist !filedate! md !filedate!
copy %%B !filedate!
)
)
pause
Seems to work for me.
I just felt like making an all-batch solution.
No, that won't work. "Date Picture Taken" is an EXIF attribute, and while the actual date of the picture can be used for this it breaks down when that file is copied or moved, whereas the EXIF data stays intact.