How to combine multiple pdf files based on location and name with command line?

Although you specifically asked for bash script but as a supplemental answer you could consider using the python script below. Interestingly, a part of python project (Ipython) was specifically designed to replace bash.

from PyPDF2 import PdfFileMerger
import os 



def merge_it(files,path):
    merger = PdfFileMerger()
    for file in files:
        merger.append(file)

    merger.write(os.path.join(path,"combined_file.pdf"))
    merger.close()


for path, dirs, files in os.walk(os.getcwd()):
    for dir in dirs:
        if dir == 'tmp':

            pdf_files = []
            for file in os.listdir(os.path.join(path,dir)):
                if file.endswith(".pdf"):
                    pdf_files.append(os.path.join(path,dir, file))
            merge_it(pdf_files,os.path.join(path,dir))

The thing this program demands is to hard-code the paths containing /tmp sub-folders. That can also be automated depending on how much automation you want. I won't recommend removing original pdfs unless they are occupying too much space.

UPDATE: Searches for all sub-folders having name 'tmp' in the current working directory and combines all pdf files inside each of the tmp folder.