Solved

copying files

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
LPT Port to USB Printer Windows 7 23 642
Reset Log Generation 3 14
Exchange 2010 meeting invite shows up everyday 8 536
Notebook Graphics performance. 5 57
Have you ever had a hard drive that you can't boot into, but need to change the registry? Here is the solution! This article guides you through accessing and editing a registry of a non-primary drive. To read registry information on a non-prim…
Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

919 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

18 Experts available now in Live!

Get 1:1 Help Now