Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
cappsie
- Posts: 1
- Joined: 11 May 2012 08:45
#1
Post
by cappsie » 11 May 2012 09:00
Hi,
I generate two PDF files, generally something like Z123456_1 and Z123456_2.
I then merge the files using PDFSAM:
http://www.pdfsam.orgWhat I'd like to do change the "merge.pdf" to the Z123456.
Then I need to create a datestamped-directory, with the the Z123456 as the name.
Finally, I copy the three PDFs into that directory.
Clear as mud?
Thanks in advance

Adam
-
Aacini
- Expert
- Posts: 1932
- Joined: 06 Dec 2011 22:15
- Location: México City, México
-
Contact:
#3
Post
by Aacini » 11 May 2012 10:43
Code: Select all
@echo off
rem This Batch file take "Z123456..." name in the first parameter
rem Here: Generate the two PDF files
rem Here: Merge the files
for /F "delims=_" %%a in ("%~1") do set baseName=%%a
ren merge.pdf "%baseName%.pdf"
for /F "tokens=1-3 delims=/" %%a in ("%date%") do (
rem Next line must be changed accordingly to locale date format:
dateStamp=%%c%%a%%b
)
md "%dateStamp%_%baseName%"
copy "%baseName%*.pdf" "%dateStamp%_%baseName%"