Link to home
Start Free TrialLog in
Avatar of Rana Bilal
Rana Bilal

asked on

Merge pdf files with batch proccess with every 2 pdf file only into 1 pdf

i have a folder which have 50000 Pdf file and every file have one page .
i want to merge every 2 pdf file into 1 pdf file than next 2 pdf file and again next and so on  .....until 50000.
for example

have file

FDN-12-1111_1
FDN-12-1111_2
FDN-12-1111_3
FDN-12-1111_4
FDN-12-1111_5
FDN-12-1111_6

its merge  2 pdf file
FDN-12-1111_1
FDN-12-1111_2

after merge name like that
FDN-12-1111_1

than next 2 pdf file

FDN-12-1111_3
FDN-12-1111_4

after merge filename

FDN-12-1111_2

than next 2 pdf file
 
FDN-12-1111_5
FDN-12-1111_6

after merge filename

FDN-12-1111_3

is it possible that with batch process its merge pdf file and give same filename of merge file as its original filename. if file name are same more than one than its add number 1,2,3 like

if file name change like this

FDN-12-1112_1
FDN-12-1112_2.

than after merge filename

FDN-12-1112_1

and so on
anyone help
thanks
rana
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Hi Rana,
I wrote a program called CAPTAIN (Combine All PDFs Together with Agreeing Initial Names). The Quick Start Guide for it is attached to this post. As you can see from the QSG, it has a lot of the elements needed to solve your issue, but not everything. For example, if you specify 11 as the number of leading characters that need to match, the current version of CAPTAIN will merge these files...

FDN-12-1111_1
FDN-12-1111_2
FDN-12-1111_3
FDN-12-1111_4
FDN-12-1111_5
FDN-12-1111_6

...into this file:

FDN-12-1111

So, CAPTAIN needs customization in order to be a solution for you, but it is certainly possible to change it so that it will merge these files...

FDN-12-1111_1
FDN-12-1111_2

...into this file:

FDN-12-1111_1

And these files...

FDN-12-1111_3
FDN-12-1111_4

...into this file:

FDN-12-1111_2

And these files...

FDN-12-1111_5
FDN-12-1111_6

...into this file:

FDN-12-1111_3

And so on...for all 50,000 files.

I'll send you a PM in the EE Message System to discuss this further, as I've done with many EE members for this program and several other programs. I should point out that this is now an acceptable approach, compliant with EE's Terms of Use, since EE removed the Gigs product and the Hire Me feature. Regards, Joe
CAPTAIN_v1.7_Quick_Start_Guide.pdf
Avatar of Rana Bilal
Rana Bilal

ASKER

Hi joe
thanks for help

i have multiple file with Diffrent name but every pdf file have 2 file with same name almost.

like

 FDN-12-1111_1

but i have this type of file also

FDN-12-1211_1
FDN-12-1311_1
FDN-12-1212_1
FDN-12-1401_1

i already mention that 2 pdf file have same name before last underscore.
for example
if i merge 50000 file than after merge its remain only 25000.....b`coz same name of pdf files...
i want to merge them by filename match before last underscore.
i want to merge them by filename match before last underscore.
Yes, I got that. The match is on everything before the last underscore. For example, these files...

FDN-12-1211_1
FDN-12-1211_2

will be merged into this file:

FDN-12-1211_1

and these files...

FDN-12-1311_1
FDN-12-1311_2

will be merged into this file:

FDN-12-1311_1

and these files...

FDN-12-1212_1
FDN-12-1212_2

will be merged into this file:

FDN-12-1212_1

and these files...

FDN-12-1401_1
FDN-12-1401_2

will be merged into this file:

FDN-12-1401_1
if i merge 50000 file than after merge its remain only 25000
Correct. The customized CAPTAIN will merge two input files, an odd-page/even-page pair, into one output file, with the name of the output file being the name of the odd-page input file (that's why I said in my PM to you that I'll probably call the customized program CAPTAINoe, where the "oe" stands for odd/even). Regards, Joe
yeah i need that type of program.
one another thing sir
if file have only one file
fdn-12-1211_1

than this type of file not to be merge b`coz of its missing of second pair file
this one
fdn-12-1211_2

another example
fdn-12-1211_1
fdn-12-1211_2
fdn-12-1211_3
fdn-12-1211_4
fdn-12-1211_5

program merge only first 4 not fifth file due to single file...program skip  this one and go to next file which have diffrent name
and so on and end of merge its show the file which is merged and which is skip due to single file.

i ready send PM ...let me know i`m waiting
No problem. If the even-named file of the odd-even pair does not exist, CAPTAINoe will simply move the odd-named file to the destination folder.
No thats type of file will not move to destination folder its remain with main folder .Only merged file go to destination folder.
OK, if the even-named file of the odd-even pair does not exist, CAPTAINoe will simply leave the odd-named file in the source folder.

I'm leaving my office for an hour or so now. I'll check back into this thread as soon as I return. Regards, Joe
A few clarification questions:

(1) Are all the file names in this format:

3 characters
hyphen
2 characters
hyphen
4 characters
underscore
non-zero integer

If not, what other naming conventions are possible? An important point is that there is one, and only one, underscore.

(2) Is there ever a "_2" file (or a higher number than 2) when there is not a matching "_1" file?

(3) Do you need to recurse subfolders or are all the files in a single folder?

(4) Assuming you don't recurse subfolders, do you ever want to store the combined/merged output files in the same folder as the input files, or will the output files always go into a destination folder that is different from the source folder?

Regards, Joe
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.