Script for saving pdf

Hello,

I am looking for a script to save a pdf file to a path with a special name.
The trick is i only want to have to fill in a small part of the path and a part of the file name, and the file name also has to containe the date.

For example the path/name is:
C:\projects\13-2332\calculations\R2R 13-2332 20180519 Main calculation.pdf

The 2 varaiabels are 13-2332 and Main calculation
And 2080519 is the date

Is that possible ?

Gr Tom Glass

This should do what you want. Just save it as a .bat and change the two things in ( ) after ‘cd’ and ‘ren’.
Only problem with the user input parts is you can’t use spaces.

    REM Finds the date
    for /f "tokens=1-4 delims=/ " %%a in ("%date%") do (
         set month=%%b
         set day=%%c
         set year=%%d
    )
    set date=%year%%month%%day%

    REM This is where the replacement for 13-2332 would be typed
    set /p var="Type folder name: "

    REM This is where the replacement for Main calculation would be typed, NO SPACES. 
    set /p var2="Enter last part of file name: "

    REM Renames PDF and moves to folder (creates if it doesn't exist). 
    cd (Location where pdf is saved)
    ren "(name of pdf when saved).pdf" "R2R %var% %date% %var2%.pdf"
    xcopy "R2R %var% %date% %var2%.pdf" "c:\projects\%var%\calculations\R2R %var% %date% %var2%.pdf*"
del "R2R %var% %date% %var2%.pdf"