Drag and drop does not work from some folders

Started by jls3512, August 10, 2013, 06:20:37 PM

Previous topic - Next topic

jls3512

I have an ExifTool shortcut where I put my parameters in the "target" field as such:

C:\util\exiftool.exe -SubIFD:CFAPattern2="2 1 1 0" "-filename=%f-CS.%e" -k

and it's working fine from anywhere I drag and drop to EXCEPT one location:

any files I try to drag and drop from "L:\Lightroom Data\Photos\Sony α65 IR\2013-08-10"  give me the following error:
Error: File not found - L:/Lightroom Data/Photos/Sony a65 IR/2013-08-10/DSC05907.dng
  0 image files updated
  1 files weren't updated due to errors

if you look close, my "Sony α65 IR" folder  has the proper α (lower greek alpha) symbol in it, as that is the official designation of this camera... it's not an a65,  it's and α65   (alpha 65).. somewhere along the way my α got translated to a.  It's not the command prompt, because if I do:

L:
cd "\Lightroom Data\Photos\Sony α65 IR\2013-08-10"

it works just fine.. 

but even if I'm in that directory and try to manually type in
C:\util\exiftool.exe -SubIFD:CFAPattern2="2 1 1 0" DSC05907.dng

I get the same error

So I know, the obvious solution is to rename the folder.. but, it's not really that simple... I have thousands of photos in that folder all in a huge directory structure that is all registered with Adobe Lightroom and Adobe Bridge CS6... and if I rename it NOW, none of those programs will know where all my photos are, and I'll have a huge mess.   I have never run into an issue with the α in the directory name before, and every other program seems to use it just fine.

So is there SOME way I can make it use the α instead translating it to a?


Phil Harvey

Sorry, this is a known problem with the Windows version.

Quotebut even if I'm in that directory and try to manually type in
C:\util\exiftool.exe -SubIFD:CFAPattern2="2 1 1 0" DSC05907.dng

I don't understand this.  It really should work.  Does "exiftool ." work when you are in this directory?

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

jls3512

Thanks for the link to the explanation of the problem

Quote from: Phil Harvey on August 10, 2013, 08:44:59 PM
I don't understand this.  It really should work.  Does "exiftool ." work when you are in this directory?

no, when I do "c:\util\exiftool . "  while in the directory, it just says
1 Directory scanned
0 image files read

if I rename the directory and replace the α with an a, then it scans all the files in the directory.

As a workaround, I can possibly write a batch file to rename the directory, run exiftool, then rename it back.

I'm not sure how to send all the agruments to exiftool in a batch file.. if I try something like :
C:\util\exiftool.exe -SubIFD:CFAPattern2="2 1 1 0" %1 %2 %3 %4 %5
it will get the first 5 files when I drag and drop to a shortcut with this.. I guess I could put all the way up to %1000 or something but there must be a way to pass ALL the arguments to exiftool


jls3512

NVM I found how to do it...

C:\util\exiftool.exe -SubIFD:CFAPattern2="2 1 1 0" %*

seems to work

ryerman

I'm glad that works for you but I still get a "file not found error". :'(

Here's another solution:

My experience is that Exiftool will process files using short file names (SFN) (aka DOS or 8.3 filename).

You can use this feature for your specific purpose by creating a .BAT file containing this line:
C:\util\exiftool.exe -SubIFD:CFAPattern2="2 1 1 0" "-filename=%~n1-CS%~x1" "%~s1" -k
Instead of using a shortcut, drag and drop a file onto the .BAT file.

%~n1, %~x1, and %~s1 are modifications to the expansion of the %1 arguement.

%~n1 expands to the file name
%~x1 expands to the file extension
%~s1 expands to the path containing short names only

The .BAT file described above works for any file name, but only because a new file is created.
To execute exiftool commands that result in a modified file with the same name, a .BAT file like the following might be used:
set TempFileName=%~n1-temp%~x1
exiftool -ExiftoolOption1 -ExiftoolOption2 -AnotherExiftoolOption "-filename=%TempFileName%" "%~s1"
del %1
ren "%TempFileName%" "%~nx1"
pause

I have not tested enough to discover any problems or disadvantages.

More information about batch parameter expansion

Jim
Windows 10 Home 64 bit, Exiftool v12.61

jls3512

Thats' really a much better approach, because with my re-naming the directory then re-naming it back method, I can't have anything open in any part of the directory at all.. using the short filenames will solve this problem!  thanks for the suggestion

Phil Harvey

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

jls3512

Quote from: ryerman on August 11, 2013, 11:01:30 AM
You can use this feature for your specific purpose by creating a .BAT file containing this line:
C:\util\exiftool.exe -SubIFD:CFAPattern2="2 1 1 0" "-filename=%~n1-CS%~x1" "%~s1" -k
Instead of using a shortcut, drag and drop a file onto the .BAT file.

I tried this, and it does seems to work fine, for one file at a time... but when I drag a lot of files to it, it only does the first one.
I looked at the document you linked, and it states:
The %~ modifiers may not be used with %*  so I can't just put *'s where the 1's are... and using the 1's I could only go up to 9 but I have folders with hundreds of files to be processed all at once.

%* was how I was getting it to process multiple files...    I am wondering two things... could I somehow maybe make one batch e with the %* call another batch file with the %~n1-CS%~x1" "%~s1" and somehow make it work with an unknown quantity of multiple files?

  ...OR...  and this would be much better...

Could I make it somehow leave the filenames off, and just drag one file from the folder I want to convert and have it only pass the path to ExifTool, and it would know to process everything in the folder?   I will always want to process the entire folder for what I am doing, and if I could just drag and drop one file from the folder and then it would process the entire containing folder, that would be just great!  I don't know how to make it process an entire folder and still add a -CS to the end of each file name though. 

any ideas on how I might achieve this?



ryerman

Quote from: jls3512 on August 12, 2013, 02:16:49 PM

  ...OR...  and this would be much better...

Could I make it somehow leave the filenames off, and just drag one file from the folder I want to convert and have it only pass the path to ExifTool, and it would know to process everything in the folder?   I will always want to process the entire folder for what I am doing, and if I could just drag and drop one file from the folder and then it would process the entire containing folder, that would be just great!  I don't know how to make it process an entire folder and still add a -CS to the end of each file name though. 

any ideas on how I might achieve this?
By design, Exiftool accepts files and/or folders.
I believe most, if not all, commands can have multiple files and/or folders specified.  I don't know how to overcome this "Windows unicode problem" and still create a command that accepts files and/or folders.

But, this .BAT file should do what you want for folders:

exiftool -r -ext dng -SubIFD:CFAPattern2="2 1 1 0" "-filename=%%f-CS.%%e" "%~s1" -k

Notice the added options:
-r will also recurse through all sub-folders contained in the dropped folder
-ext dng will restrict processing to .DNG files.  Otherwise, the command will also process all acceptable files like .JPG or .PNG

The result should be that, for every .DNG file in the parent folder and all its sub-folders, a re-named copy is created with the new CFAPattern2.
However, it will give undesired results if the file basename contains any problematic unicode characters.

I recommend to test with some non-crucial file structures until you are sure it does what you want.
For instance, drop a test folder twice in a row and see what happens.

Jim
Windows 10 Home 64 bit, Exiftool v12.61

jls3512

Thank you very much for the help.. I finally got it to work.  None of the filenames themselves have any unicode characters, it's just this one folder name.  I couldn't get it to all go through the way I wanted it with one command, but I figured out a batch file scheme to rename the files afterwards... here's what I ended up with:

C:\util\exiftool.exe -SubIFD:CFAPattern2="2 1 1 0" %~dps1 -ext dng
ren "%~dps1*.dng_original" *.orig
ren %~dps1*.dng ???????????????????????????????-CS.dng
ren %~dps1*.orig *.dng
Pause

with this I just need to drag and drop one file from the folder I wish to process, and it will process all the files in that folder, so much easier than trying to highlight all the files, especially since I can't find something like 'select all' in windows 7.. there's probably a way to do it but I don't know what it is, and it's not listed in any of the pulldowns or by right clicking.. anyway, since I always want to process the entire folder, dragging and dropping just one random file from that folder is quick and easy and it work with this.

This ends up with the changed files called DSC05734-CS.dng and ends up giving the backups their original names back.

I couldn't get it to work another way such as with the -O command because I couldn't get it to pass along the correct filename

I have to rename all the .dng_original files to something else first otherwise they get renamed with the *.dng rename..  and then I ended up with things like DSC05734-CS.dng.dng_original.. I can't remember if it was that exactly but something I along those lines.

I don't understand why or how they broke it so ren *.dng *-cs.dng wouldn't work.. but that results in a file called
DSC05734.dng-CS.dng   but the ?'s work and I'll never have a file name longer than all those.

I'm sure these little quirks have to do with long file names... but anyway, I got it to work, so thanks for the help and advice!
as you pointed out, this will only work to fix unicode in the path, not the file names, but that's fine for my purposes.
If there's a better way I could have done this, I'd like to hear it, but since this is working, no need to think to much about it.


ryerman

You're welcome.

It would be nice to confirm whether or not my method works.
Did you try dropping a folder on the batch file shown in my August 12 post?

(btw, %%f-CS.%%e is not a typo.   In a batch file, % must be doubled when used in an exiftool option.)

Jim
Windows 10 Home 64 bit, Exiftool v12.61

jls3512

I tried it with

exiftool -r -ext dng -SubIFD:CFAPattern2="2 1 1 0" "-filename=%%f-CS.%%e" "%~s1" -k

and it works for only the first file, it doesn't process the whole directory... even if I drag all the files to it, it still just does the first file.

I just noticed my whole string of ? turned into smile faces in my last post LOL    ?????????

I guess I should have posted it like this:

C:\util\exiftool.exe -SubIFD:CFAPattern2="2 1 1 0" %~dps1 -ext dng

ren "%~dps1*.dng_original" *.orig
ren %~dps1*.dng ???????????????????????????????-CS.dng
ren %~dps1*.orig *.dng

Pause


ryerman

When I drag and drop a folder, all the contained .DNG files are processed.
I hope you are dragging a folder and not a file or multiple files.

But as you said, you have found your own solution, so I won't think about it any more. :)
I can't explain our differing results.

Jim
Windows 10 Home 64 bit, Exiftool v12.61

jls3512

oh... drag a FOLDER   *duh... yes I just tried that and it DOES work if I drag a folder to it.   I somehow missed that.   I do like it better not having to do all those re-names

Thanks again for the help and thanks for pointing out I should drag the entire folder.. that simply just never occurred to me as a way to do this