# Import and merge PDF files

I have a folder with several pdf no more than 50, I would like to import them to be disordered and that the output was a single pdf (you can imagine it as a proof of form A and we want to produce form B, where the files are the questions)

files = {"file1.pdf", "file2.pdf", "file3.pdf", "file4.pdf", "file5.pdf",
"file6.pdf", "file7.pdf", "file8.pdf", "file9.pdf", "file10.pdf",
"file11.pdf", "file12.pdf", "file13.pdf", "file14.pdf", "file15.pdf",
"file16.pdf", "file17.pdf", "file18.pdf", "file19.pdf", "file20.pdf",
"file21.pdf", "file22.pdf", "file23.pdf", "file24.pdf", "file25.pdf"};

Sort[files]


the previous order, but as disorderly?

**Edit How do I import all the files from a c: \ directory?

how do I merge all those files into the same file called file and record it in the same directory as c: \?**

• Do you mean randomly sorted? RandomSample@files – Rohit Namjoshi May 26 '19 at 23:55
• @ Rohit Namjoshi , it works very well that order thanks, now as I do to import the files from the ws directory or obtain the output merged into pdf in the same directory with the name say fileB , I imagine something like that but it does not work list = FileNames[FileNameJoin[dir, "filename*"]] – wally May 27 '19 at 0:18
• Not really sure what you are asking. Are you trying to get a list of all files that match some pattern in a specific directory? If so, to get a list of all files with the pdf extension in directory dir: FileNames["*.pdf", dir] – Rohit Namjoshi May 27 '19 at 0:35
• I explain to you with 3 files for example, file1.pdf, file2.pdf, file3.pdf housed in c: \ ws, I need to import them, undo them and merge them into a single file called fileB, and this fileB (file1.pdf + file2.pdf + disordered file3.pdf) and burn it to the same directory c: \ ws – wally May 27 '19 at 1:27
• I do not think you can do this well in M. This question looks duplicate of merge-pdfs-to-one and combine-multiple-pdf-files-into-one-document so it is better just to use an external tool. There are many such tools to choose from. – Nasser May 27 '19 at 2:19