I have pieced together the code below and it works for one .pdf file.
But, it never gets to the second .bat file. Can someone please
explain to me what I'm doing wrong. I'll be honest I do not understand some
of this code, I mostly got it through here, but it works for sls316 and
does not execute sls312. Thank You.
main .bat:
Code: Select all
call rename_sls316.bat
call rename_sls312.bat
rename_sls316.bat :
Code: Select all
setlocal enabledelayedexpansion
FOR /F "delims=" %%G in ('dir SLS316*.pdf /a-d /b /od') do set "newest=%%~G"
copy "%newest%" "h:\BCS_Reports\Temp"
cd h:\BCS_Reports\Temp
dir /b | find "pdf" /i > temp.log
set tempvar=
for /f "tokens=1-2 delims=." /f %%A in (temp.log) do (
rename_file.bat "%%A" %%B
cd h:\BCS_Reports\Temp
batch_remove_hyphens.bat
getReportingPeriodDates.bat
del temp.log
cd h:
)
rename_sls312.bat :
Code: Select all
setlocal enabledelayedexpansion
FOR /F "delims=" %%G in ('dir SLS312*.pdf /a-d /b /od') do set "newest=%%~G"
copy "%newest%" "h:\BCS_Reports\Temp"
cd h:\BCS_Reports\Temp
dir /b | find "pdf" /i > temp.log
set tempvar=
for /f "tokens=1-2 delims=." /f %%A in (temp.log) do (
rename_file.bat "%%A" %%B
cd h:\BCS_Reports\Temp
batch_remove_hyphens.bat
getReportingPeriodDates.bat
del temp.log
cd h:
)