LuckyLucks
asked on
copying files from UNC in batch
Hello,
I am trying to copy files in UNC that are not drive mapped on the server. Apparently its not working for UNC, works file for full filenames.
My input file looks like:
"\\abc12244\myPDFS\firstfi le.pdf","C ompanyA.pd f","SubA", "A"
My batch code to copy looks like:
set BaseDir=C:\Base
set AllDir=C:\All
for /f "usebackq tokens=1-4 delims=," %%A in ("%ControlFile%") do (
call :DoIt %%A %%B %%C %%D
)
:DoIt
if not exist "%BaseDir%\" mkdir "%BaseDir%"
if not exist "%BaseDir%\%~4\" mkdir "%BaseDir%\%~4"
if not exist "%BaseDir%\%~4\%~3\" mkdir "%BaseDir%\%~4\%~3"
copy /Y "%1" "%BaseDir%\%~4\%~3\%~2"
if not exist "%AllDir%\" mkdir "%AllDir%"
I am trying to copy files in UNC that are not drive mapped on the server. Apparently its not working for UNC, works file for full filenames.
My input file looks like:
"\\abc12244\myPDFS\firstfi
My batch code to copy looks like:
set BaseDir=C:\Base
set AllDir=C:\All
for /f "usebackq tokens=1-4 delims=," %%A in ("%ControlFile%") do (
call :DoIt %%A %%B %%C %%D
)
:DoIt
if not exist "%BaseDir%\" mkdir "%BaseDir%"
if not exist "%BaseDir%\%~4\" mkdir "%BaseDir%\%~4"
if not exist "%BaseDir%\%~4\%~3\" mkdir "%BaseDir%\%~4\%~3"
copy /Y "%1" "%BaseDir%\%~4\%~3\%~2"
if not exist "%AllDir%\" mkdir "%AllDir%"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.