I have some problems in understanding what you want to do (or why), so i give no complete solution (as i can't serve it).
zagix wrote:The below codes are working but i have to manually enter each sub folder and select the pdf files and create a merged pdf and delete the single ones.
You should not delete the single files automatically, as there may occure errors, so you should better check the result:
i don't know a way to do this automatically, and i fear there is none.
zagix wrote:Open ..\pdftk\bin* and copy pdftk.exe and libiconv2.dll to a folder of your choice
Why do you want to copy the executables every time you want to merge the files?
And what do you mean with the notation for the source folder "..\pdftk\bin*"
(do you want to erxecute it on multiple system and it may be found within different locations, or
do you have multiple versions and want to use the most up to date on)?
zagix wrote:create a new text file and paste the following code
create a shortcut of this .cmd and place it in your sendto folder
I assume you meant the codeblock at the end of your post,
why don't you just place/copy the .cmd file just once to your sendto folder
(again multiple systems, or why else)?
Assumed the Sendto folder is located in your userprofile, thats name does not contain any special character:
Code: Select all
(
echo @echo off
echo setlocal enabledelayedexpansion
:: the next line should be added if !command! should not be contained in the variable command
:: set "command= "
echo FOR %%%%A IN ^(%%*^) DO ^(set command=!command! %%%%A^)
echo pdftk.exe %%command%% cat output "%%~dp1binder.pdf"
) > "%USERPROFILE%\SendTo\whatNameYouWant.cmd"
zagix wrote:Go to a folder with some PDF files and select as many PDFs as you want
Right-click them and choose the shortcut you just created
This cannot be automated, as no algorithm can predict your choice reliably,
so i assume, you want to do this still manually:
If you have created the cmd within the SendTo folder then just right click and choose SendTo-> .cmd file.
zagix wrote:The below codes are working but i have to manually enter each sub folder and select the pdf files and create a merged pdf and delete the single ones.
(...)
a new binder PDF in the same folder will be created where all selected PDFs are merged into one
I assume this is something that you expect to happen, and nothing you want to do actively: may i misunderstand you?
Additional:
Please note that the maximum command line length is limited, for example XP uses a limit of 8191 characters:
I am not firm with your tool "pdftk.exe",
maybe it supports the input of a text file with a list of pdf files, or
maybe it supports passing the name of the files per piping to STDIN.
These are the default ways to get around such a limitation.
If it does not support such things, you have to control the line length and use tempFiles with in-between results,
or you even may abort the operation with an error message.
penpen