Link to home
Start Free TrialLog in
Avatar of LuckyLucks
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\firstfile.pdf","CompanyA.pdf","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%"
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial