Solved

copying files

Posted on 2013-06-30
4
140 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

My purpose is to describe the basic concepts of virtual memory as implemented in a modern Windows-based operating system. I will also describe the problems inherent in older systems and how virtual memory solves them. The dark ages - before virtu…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now