Solved

copying files

Posted on 2013-06-30
4
145 Views
Last Modified: 2013-10-28
hello,

i am in need of a script to copy a bunch of files from different folders to a single folder, and i would like 2 options if possible: to copy to a different folder, and also to combine into a different file.

i am using windows command line.

this is what i have tried when trying to combine:

copy "E:\deleteme\test1\test1.txt E:\deleteme\test1\test2.txt E:\deleteme\test1\test3.txt E:\deleteme\test1\test4.txt" E:\deleteme\combined\combined.txt

but it failed. (i am very new to command line)

so ideally i am after a simple script i can modify when needed to copy this files from different folders into a single folder.

Regards,
0
Comment
Question by:3lijah
  • 3
4 Comments
 
LVL 23

Accepted Solution

by:
Mysidia earned 200 total points
ID: 39288968
the copy command operator to combine two files is  +     (plus symbol)

try:

E:
cd E:\deleteme\test1
copy test2.txt+test3.txt combined.txt
0
 

Author Comment

by:3lijah
ID: 39289002
thanks,

the + worked. as i have about 100+ files to group, is there a cleaner way to do this?

i have found this:

for /f "delims=" %%i in (filelist.txt) do echo D|xcopy "E:\deleteme\%%i" "E:\deleteme\combined\%%i" /i /z /y

(filelist.txt contains:

test1\test1.txt
test2\test2.txt
test3\test3.txt
test4\test4.txt)

however this copies the folders, can this be modified to copy just the files into a folder and/or to combine the files into one file.

Regards,
0
 

Author Comment

by:3lijah
ID: 39607359
I've requested that this question be closed as follows:

Accepted answer: 0 points for 3lijah's comment #a39289002
Assisted answer: 200 points for Mysidia's comment #a39288968

for the following reason:

this was not the exact answer i was looking for, but thanks.
0
 

Author Closing Comment

by:3lijah
ID: 39607360
thanks, this was on track, but i ahve decided to just use another method. thanks.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a hurry?.. scroll down to "HERE's HOW TO DO IT" Section. Greetings All, I was going to post this as question/solution, but its seems more appropriate as an article considering its length.  I felt it important to illucidate all the details c…
by Nathan Brom/Bromy2004 Introduction There are numerous websites out there for any different type of program you can imagine.  Of those, you'll need to decide which ones are legitimate and aren't trying to steal your money or infect your comput…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question