Recursive copy from text list
Posted: 27 Nov 2014 09:48
Hi,
Looking to batch copy a list of files from a text list, recursively through all sub-directories please.
I have a working batch for a single directory - just need the recursive added, if possible.
Thanks.
Looking to batch copy a list of files from a text list, recursively through all sub-directories please.
I have a working batch for a single directory - just need the recursive added, if possible.
Code: Select all
@echo off
set Source=D:\mydirectory\myfiles
set Target=D:\tmp
set FileList=C:\Users\Administrator\Desktop\move.txt
echo.
if not exist "%Source%" echo Source folder "%Source%" not found & goto Exit
if not exist "%FileList%" echo File list "%FileList%" not found & goto Exit
if not exist "%Target%" md "%Target%"
for /F "delims=" %%a in ('type "%FileList%"') do copy "%Source%\%%a" "%Target%"
:Exit
echo.
echo press the Space Bar to close this window.
pause > nul
Thanks.