Copy files in .txt to list of folders in .txt

Microsoft Windows 7 home premium upgrade...
January 11, 2010 at 18:47:00
Specs: Windows XP, P4/1GB
I'm looking for a batch file that will copy a list of files listed in a.txt to a list of folders in b.txt.

Hope someone can help.

Thanks.


See More: Copy files in .txt to list of folders in .txt

Report •


#1
January 11, 2010 at 21:31:09
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in (a.txt) do (
for /f "tokens=* delims= " %%i in (b.txt) do (
echo copy "%%a" "%%i"
)
)


=====================================
Helping others achieve escape felicity

M2


Report •

#2
January 11, 2010 at 23:14:56
i think that would copy each file in "A" to all the directories in "B". also vice-versa if files were swapped (all files in "A" going to each dir in "B") (then again, who knows, that might be what he intended...)
to: OP:
Unfort. with batch, each line in file "A" requires skipping "N" lines in file B, do the copy, then exit B-readloop. timeconsuming and kind of wasteful. If the file "A" is small, it can be stored in an array and processed that way.
more details on file sizes and arrangement would be helpful.
to: M2go:
Also, he never mentioned if this is a "line-for-line" copy or based on some kind of "interrupter"/"trigger" to switch directories. assuming "line for line" for now.

awaiting developments... (ie: the other shoe to drop)


Report •

#3
January 12, 2010 at 00:50:39
One of us read it wrong. I'll stay tuned.


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
January 12, 2010 at 01:27:42
hi,

thanks for the reply guys, but sadly it doesn't work.

this is what i need the batch file to do:

given:

a.txt file
file.aaa
file.bbb

b.txt file
e:\folder1
e:\folder2

i need to copy the files listed in a.txt(file.aaa and file.bbb) to the folders listed in b.txt(e:\folder1 and e:\folder2).

the purpose of the batch file it to copy all files listed in a.txt to the folders listed in b.txt, and the method of copying doesn't really matters.

hope this explains. incase you guys need more explaination please let me know.

thanks again.


Report •

#5
January 12, 2010 at 01:38:53
"i need to copy the files listed in a.txt(file.aaa and file.bbb) to the folders listed in b.txt(e:\folder1 and e:\folder2)."

That's what mine does but I neglected to mention that, as posted, it simply gives a preview.

T activate it, remove the ECHO in front of COPY.


=====================================
Helping others achieve escape felicity

M2


Report •

#6
January 12, 2010 at 01:56:56
yup im seeing the command but its just not doing it.

removed the "echo" and it works great! :-)

thanks Mechanix2Go thanks!


Report •

Ask Question