windows - copy list of files whose paths are in semi colon delimited source.txt file to destination folder keeping their souce paths -
i have list of files in test.txt contains list of file paths in format d:\source\www\default.aspx;d:\source\common\common.js need write bat file copy these files destination eg.f:\destination\ path passed parameter bat file.i have following script for /f %%l in (somefile.txt) ( %%f in (%%l) ( copy "%%f" %1 ) )
issue need keep copy source folder's folder structure in destination folder too. ie above d:\source\www\default.aspx need copy f:\destination\www\default.aspx not f:\destination. gratefull if 1 can give solution this.
please try xcopy /i "%%f" "%~1\%%~pf"
:
xcopy
create directory structure (without prompting because of/i
switch);%%~pf
path-only part of file copy (seehelp for
), appended destination base path without surrounding quotes%~1
;- the destination path combination enclosed in quotes.
Comments
Post a Comment