Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   Dev Hardware ForumsSOFTWAREProgramming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Hardware Forums Sponsor:
  Trader Rating: 0 · #1  
Old November 19th, 2007, 06:18 PM
bennylynch bennylynch is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 2 bennylynch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 44 m 4 sec
Reputation Power: 0
Multiple copy batch file

Hi,

I have created a batch file that copies the contents of one folder to another, however I am looking to have a copy from 3 different folders to 3 different locations within 1 batch file rather than 3: the following works fine:

xcopy G:\folder\sbfldr1 C:\folder\sbfldr1 /s

But I want to do 3 copies in 1 batch file:

Code:
xcopy G:\folder\sbfldr1 C:\folder\sbfldr1 /s

xcopy G:\folder\sbfldr2 C:\folder\sbfldr2 /s

xcopy G:\folder\sbfldr3 C:\folder\sbfldr3 /s


But I can't get this to work, what's missing?

Any help appreciated.

Thanks.

Last edited by Nilpo : November 19th, 2007 at 07:52 PM.

Reply With Quote
  Trader Rating: 2 · #2  
Old November 19th, 2007, 07:51 PM
Nilpo's Avatar
Nilpo Nilpo is offline
Dev Hardware God (5000 - 5499 posts)
 
Join Date: May 2004
Location: Salem, OH
Posts: 5,404 Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)Nilpo User rank is General 78th Grade (Above 100000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 1 Week 3 Days 19 h 42 m 53 sec
Reputation Power: 6193
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
MySpace Orkut
That should work. Double-check to make sure that your folders exist. Try adding the /c switch to skip errors.
__________________
Click the image if at any point you don't like my decision.

10011100011000101111100011100000011000000100000011 10010011011110110001101101011011110100011000001110 0100111101000100001

Visit Nilpo.com and Ask the Windows Guru!

Open me for some very useful links!    

Reply With Quote
  Trader Rating: 0 · #3  
Old November 20th, 2007, 09:52 AM
DrStrangluv's Avatar
DrStrangluv DrStrangluv is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 206 DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 5 Days 23 h 2 m 21 sec
Reputation Power: 320
It would help if you told us exactly how it fails- what is it doing incorrectly and what, if any, error message do you receive?

Reply With Quote
  Trader Rating: 0 · #4  
Old November 20th, 2007, 11:32 AM
bennylynch bennylynch is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 2 bennylynch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 44 m 4 sec
Reputation Power: 0
Quote:
Originally Posted by DrStrangluv
It would help if you told us exactly how it fails- what is it doing incorrectly and what, if any, error message do you receive?


It opens the dos window briefly then closes with no copy into the folders, if I use only the one line it works fine.

Reply With Quote
  Trader Rating: 0 · #5  
Old November 20th, 2007, 12:10 PM
DrStrangluv's Avatar
DrStrangluv DrStrangluv is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 206 DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level)DrStrangluv User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 5 Days 23 h 2 m 21 sec
Reputation Power: 320
what if you open a command window, navigate to the folder containing the .bat file in dos, and type the name of the .bat file in? You should get some more info that way about what's happening.

Reply With Quote
  Trader Rating: 0 · #6  
Old January 29th, 2008, 08:56 PM
dutch_boi1 dutch_boi1 is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 3 dutch_boi1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 48 sec
Reputation Power: 0
Thumbs up

at the end of your code add a @PAUSE
the bat file should stop and wait for ur key, u should be able to see what happens.
if you want you could try my code, it is designed to copy about 6 folders to where u want them, i also wrote a setup program for it.

also the /s flag.. u sure ur source directories contain files? if not nothing will be copied.

so your code could become:

Code:
@ECHO OFF

xcopy G:\folder\sbfldr1 C:\folder\sbfldr1 /s
xcopy G:\folder\sbfldr2 C:\folder\sbfldr2 /s
xcopy G:\folder\sbfldr3 C:\folder\sbfldr3 /s

@PAUSE
 


also, im not sure if ur windows has it but mine does, u could try this simple 1 line command which would copy the whole folder ur on about. i know this is kinda much for what u want but its just my 2 cents, this is a snippet of my code so yeah.

Code:
@ECHO OFF
ECHO Copying Folders..

SET prefix=robocopy_backup
REM Set the log file name based on the current date.  This
REM will record the results from the robocopy command.
REM The typical format for the date command is:
REM Mon 11/09/2000
REM So, we are parsing the date by moving 4 characters back and 
REM copy 4 characters to get the 4-digit year, then we get the 
REM 2-digit month by moving 10 characters back and copying 2 
REM characters.  Finally, we get the day by moving 7 characters
REM back and copying 2 characters.
SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log

ROBOCOPY G:\folder\ C:\folder\ /COPY:DAT /LOG+:%log_fname%


That above will copy the folder from G:\ to C:\ , the COPYAT basically copies file data, attributes, and timestamps where as the /LOG part makes a log file int he folder with the bat telling you what was copied, how big etc.

Keep in mind not all systems have robocopy. im in vista home premium so yeah. lemme know how it goes.

Last edited by dutch_boi1 : January 29th, 2008 at 09:08 PM. Reason: damn spelling..and forgot something

Reply With Quote
Reply

Viewing: Dev Hardware ForumsSOFTWAREProgramming > Multiple copy batch file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT