Question

Well, it kind of does but skips one level I think. So, here's folder structure I have (Windows 2008 R2 SP2 standard):

ClientA
   |_ClientAfolder1
   |_ClientAfolder2

ClientB
   |_ClientBfolder1
   |_ClientBfolder2

And so forth... Here's the script I'm using:

for /f "delims=" %%a in ('type "folderlist.txt" ') do robocopy "%%a" "Z:\temp\test" /E /xo /fft /COPYALL /r:0 /w:0

My folderlist.txt looks like this:

f:\ClientA\ClientAfolder1
f:\ClientA\ClientAfolder2
f:\ClientB\ClientBfolder1
f:\ClientB\ClientBfolder2

And after executing the script, my folder structure becomes like this:

   ClientAfolder1
   ClientAfolder2
   ClientBfolder1
   ClientBfolder2

So, it skips creating parent folders which are ClientA and ClientB. What am I doing wrong?

Thank you for any help.

Was it helpful?

Solution

for /f "usebackq delims=" %%a in ("folderlist.txt") do (
    robocopy "%%a" "Z:\temp\test%%~pnxa" /E /xo /fft /COPYALL /r:0 /w:0
)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top