Hello,
I created a bat file in windows and put following commands into it:
@echo on
cd /d "d:\1_pdf\test_pdf\"
start "\\d:\\1_pdf\test_pdf" exiftool.exe -csv -Title -Author -Description -Keywords -PageCount d:\1_pdf\test_pdf > upload_pdf_list.csv
pause
Result is that the upload_pdf_list.csv file will be created but is EMPTY (0 kb).
If I run the same command in the command windows in Windows, the csv file will be created and all metadata will be exported as it should be.
Any suggestions how I have to modify the code? I'm a newbie, so please clear instructions. ;)
Where is Exiftool located? Maybe try using the full path to Exiftool?
Quote from: StarGeek on June 22, 2016, 03:05:32 AM
Where is Exiftool located? Maybe try using the full path to Exiftool?
Still the same, I now changed the code as follows to tackle your suggestion:
@echo on
cd /d "d:\1_pdf\test_pdf\"
start exiftool.exe -csv -Title -Author -Description -Keywords -PageCount d:\1_pdf\test_pdf > upload_pdf_list.csv
pause
Result is: file will be created but content is empty and it still keeps 0 kb.
On the cmd line, type Where Exiftool. This will tell you the full path to the executable. It should be something like "C:\Path\To\exiftool.exe"
Try using that in your batch file instead of just instead of just exiftool.exe, i.e. start C:\Path\To\exiftool.exe
My guess is exiftool is not located in a place that the batch file can find normally, especially after you change directories.
Quote from: Victoor on June 22, 2016, 03:28:50 AM
@echo on
cd /d "d:\1_pdf\test_pdf\"
start exiftool.exe -csv -Title -Author -Description -Keywords -PageCount d:\1_pdf\test_pdf > upload_pdf_list.csv
pause
Result is: file will be created but content is empty and it still keeps 0 kb.
The redirection refer to the
start command.
Remove the start
exiftool.exe -csv -Title -Author -Description -Keywords -PageCount d:\1_pdf\test_pdf > upload_pdf_list.csv
or you need the escape the redirection sign
start exiftool.exe -csv -Title -Author -Description -Keywords -PageCount d:\1_pdf\test_pdf ^> upload_pdf_list.csv
Quote from: Victoor on June 22, 2016, 02:18:47 AM
Any suggestions how I have to modify the code? ;)
Hi Victoor.
My experience is that if the START command is used, the
/b switch must be included.
ie start
/b C:\Path\To\exiftool.exe
https://technet.microsoft.com/en-us/library/cc770297.aspx (https://technet.microsoft.com/en-us/library/cc770297.aspx)
For me, this is true in the command window as well as a batch file.
But as olboll says, the START command is unnecessary.
I found that escaping the redirection symbol did not allow the CSV file to be created.
Assuming exiftool is in the PATH, the BAT file can be simplified like this:
exiftool.exe -csv -Title -Author -Description -Keywords -PageCount "d:\1_pdf\test_pdf" > "d:\1_pdf\test_pdf\upload_pdf_list.csv"
pauseIt could be generalized so that either a file or folder can be dropped on it like this:
exiftool -r -ext pdf -csv -Title -Author -Description -Keywords -PageCount %1 > "W:\some path\to wherever\you want\FileName.csv"In a batch file, %1 expands to the quoted full path of whatever is dropped on it.
Use option
-r to recurse through all subfolders
Use option
-ext pdf to process only PDF files
You may want to generalize it even further by writing the CSV file on the Desktop, like this:
set TimeStamp=%time::=%
exiftool -r -ext pdf -csv -Title -Author -Description -Keywords -PageCount %1 > "%USERPROFILE%\Desktop\%~n1-%TimeStamp:.=%.csv"
Quote from: olball on June 22, 2016, 01:15:51 PM
The redirection refer to the start command.
Ah, that makes sense. I'm unfamiliar with the Start command.