1

I am using PDFtk-server to merge 2 PDF files. This creates a new PDF with name Test_.

Now, what I am looking for is a batch files that renames the Test_ files to Test_datestamp and then move them into another folder and delete the files.

It is working if only one file is present.

pdftk C:\test\*.pdf C:\test\file-to-add\file.pdf cat output C:\test\output\Test_.pdf

ren "C:\test\output\*pdf" "Test_ - %date:/=.% %time::=-%.pdf"
del C:\test\*.pdf

Then comes to copy part to other folders.

If having multiple files, the first one gets renamed but other not, because it is trying to set the same timestamp, so I need some kind of delay between renaming.

double-beep
  • 5,031
  • 17
  • 33
  • 41
sahara
  • 11
  • 1
  • There is a wrong file mask in your `ren` command line (it should read `*.pdf`). But why aren't you using the file `Test_.pdf` you created in the previous line? Anyway, I think what you are looking for is a [`for` loop](https://ss64.com/nt/for.html) to process multiple files; you need to make sure then that you don't rename the same file twice (see [this](https://stackoverflow.com/q/31975093))... – aschipfl Jul 16 '19 at 11:35

0 Answers0