My task is:
I have a single %SourceDir% with many if not hundreds of files with unique names. All in the same folder.
I have the %DestDir%/%SubFolder1%/%SubFolder2%/%SubFolder3%/%SubFolder4%/(up to 4 subfolders deep)
I have to write a batch file that would read from the file_list.txt (which basically would be dir/b/s output from another version of that same %DestDir% and create the corresponding paths and copy the corresponding files within.
PLS advice.
Long ago I made something much simpler, which back then worked, but is nothing with the current task at hand
Code: Select all
@echo off
set src_folder=T:\TEST\source
set dst_folder=T:\TEST\destination
set file_list=T:\TEST\file_list.txt
//some way to read the path when the loop begins and before copying the line with the file and create it "if not exist"
//set pathfromlist=%DestDir%/%SubFolder1%/%SubFolder2%/%SubFolder3%/
//PLS advice
if not exist "%dst_folder%" mkdir "%dst_folder%"
for /f "delims=" %%f in (%file_list%) do (
xcopy "%src_folder%\%%f" "%dst_folder%\"
)
Thanks in advance.
Here's my info,even though imho @ the moment is irrelevant.
Code: Select all
INFO.BAT version 1.5
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [Version 10.0.18362.535]
Product name : Windows 10 Pro Education, 64 bit
Performance indicators : Processor Cores: 8 Visible RAM: 67053976 kilobytes
Date/Time format : (mm/dd/yy) Tue 01/14/2020 20:59:41.10
__APPDIR__ : C:\WINDOWS\System32\
ComSpec : C:\WINDOWS\System32\cmd.exe
PathExt : .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Extensions : system: Enabled user: Disabled
Delayed expansion : system: Disabled user: Disabled
Locale name : en-US Code Pages: OEM 866 ANSI 1251
DIR format : 01/10/2020 03:54 PM 34,359,738,368 pagefile.sys
Permissions : Elevated Admin=No, Admin group=Yes
Missing from the tool collection: debug