M
Matthias Tacke
Simply exchange the src path with target path using set.S>B>S said:Here is the actual script
::::::::::::::::::::::::::::::::::::::::::::
@echo off
setlocal
set srcDir=c:\UPDATES
set trgDir=c:\APPFILES
set len=10
for /f "delims=" %%F in ('dir %srcDir% /A-D/B/S') do (
call :sub "%%~F"
)
goto :eof
:sub
set Name=%~1
set flName="%trg%%Name:~10%"
set Path=%~dp1
if exist %flName% (
psfile %flName% -c
)
copy "%Name%" "%trg%%Path:~10%"
::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::
@echo off
setlocal EnableDelayedExpansion
set srcDir=c:\UPDATES
set trgDir=c:\APPFILES
for /f "delims=" %%F in ('dir %srcDir% /A-D/B/S') do call :sub "%%F"
goto :eof
:sub
set Name=%~1
set flName=!%Name:%srcDir%=%trgDir%!
if exist "%flName%" psfile "%flName%" -c
copy /Y "%Name%" "%flName%"
::::::::::::::::::::::::::::::::::::::::::::
Untested
HTH