MS Batch File Copying

Reply

Join Date: Jan 2006
Posts: 173
Reputation: RwCC is an unknown quantity at this point 
Solved Threads: 4
RwCC's Avatar
RwCC RwCC is offline Offline
Junior Poster

MS Batch File Copying

 
0
  #1
Feb 20th, 2007
Hey everyone,

I am always having to copy DLLs from various folders for various reasons. So I thought if I had a .bat file to do it then it would save me bucket loads of time.

So is anybody here able to provide code to copy from several folders and place them into a single one?

The folders with the DLLs are along the lines of:

C:\FileManager\Implementation\bin\Debug\fileman.dll
C:\Viewer\Implementation\bin\Debug\viewer.dll
C:\Resource\Implementation\bin\Debug\resource.dll

And I would like them to be placed into a folder like:
C:\DllFiles

I have seen some code for copying files, but it just does a full copy of the folder. So is there a way to just get the specific DLLs (and not any referenced ones contained in Debug) I want instead of the other files MS Visual Studio creates in Debug?
Sir David Healy - Northern Ireland Goal King
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: MS Batch File Copying

 
0
  #2
Feb 22nd, 2007
use copy or xcopy.

*.dll just copies files with the .dll extension.

http://www.computerhope.com/xcopyhlp.htm

Is a good resource.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 36
Reputation: mittelgeek is an unknown quantity at this point 
Solved Threads: 0
mittelgeek's Avatar
mittelgeek mittelgeek is offline Offline
Light Poster

Re: MS Batch File Copying

 
0
  #3
May 30th, 2007
For the data set:

C:\FileManager\Implementation\bin\Debug\fileman.dll
C:\Viewer\Implementation\bin\Debug\viewer.dll
C:\Resource\Implementation\bin\Debug\resource.dll

Try something like:
@echo off
for /f %%G in ("FileManger","Viewer","Resource") do (
   for /f %%H in ("fileman","viewer","resource") do xcopy /c /h /v /y %%G\Implementation\bin\Debug\%%H.dll
)
Very quick and very very dirty. Need some error checking and should also put in a method to specify files from the command line or another file.

Gotchas are going to be the parenthesis and the strings to iterate through. Check out www.ss64.com/nt. Not a plug; just an excellent reference site for Windows and other OSes with command line access.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 319
Reputation: DenisOxon is an unknown quantity at this point 
Solved Threads: 15
DenisOxon's Avatar
DenisOxon DenisOxon is offline Offline
Posting Whiz

Re: MS Batch File Copying

 
0
  #4
May 31st, 2007
Originally Posted by RwCC View Post

The folders with the DLLs are along the lines of:

C:\FileManager\Implementation\bin\Debug\fileman.dll
C:\Viewer\Implementation\bin\Debug\viewer.dll
C:\Resource\Implementation\bin\Debug\resource.dll

And I would like them to be placed into a folder like:
C:\DllFiles
Here is a dead simple way, copy and paste this to your batch file and give it a try, then add any additional files you wish to copy to the batch file.

@echo off
copy C:\FileManager\Implementation\bin\Debug\fileman.dll C:\DllFiles\*.*
copy C:\Viewer\Implementation\bin\Debug\viewer.dll C:\DllFiles\*.*
copy C:\Resource\Implementation\bin\Debug\resource.dll C:\DllFiles\*.*

When you run this a second time you will probably be prompted to overwrite file. If you wish to avoid mess age add /Y to end of each copy line.

The echo off command just stops the command being displayed.

Have fun

Denis
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Legacy and Other Languages Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC