batch, please.. tkx.
have two lan dir:
source dir:
\\mylnadir1\dir1\
destination dir:
\\mylnadir2\dir2\
from source dir i need to loop all .txt files (only this type with .txt), check if in destionation dir are present if not copy, from source and paste in destination, naturally kill file from source...
tath is all.
tkx
copy and kill file
Moderator: DosItHelp
Re: copy and kill file
Untested:
Code: Select all
SET "SOURCE_DIR=\\mylnadir1\dir1"
SET "DEST_DIR=\\mylnadir2\dir2"
PUSHD "%SOURCE_DIR%"
FOR /F %%A IN ("*.txt") DO (
IF NOT EXIST "%DEST_DIR%\%%~A" (
COPY /Y "%%~A" "%DEST_DIR%"
DEL /F /Q "%%~A"
)
)
POPD
Re: copy and kill file
Remove the /F.SIMMS7400 wrote: ↑02 Aug 2018 05:51Untested:
Code: Select all
SET "SOURCE_DIR=\\mylnadir1\dir1" SET "DEST_DIR=\\mylnadir2\dir2" PUSHD "%SOURCE_DIR%" FOR /F %%A IN ("*.txt") DO ( IF NOT EXIST "%DEST_DIR%\%%~A" ( COPY /Y "%%~A" "%DEST_DIR%" DEL /F /Q "%%~A" ) ) POPD