|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|||
|
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. |
|
||||
|
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!
![]() |
|
|||
|
Quote:
It opens the dos window briefly then closes with no copy into the folders, if I use only the one line it works fine. |
|
|||
|
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 COPY AT 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 |
![]() |
| Viewing: Dev Hardware Forums > SOFTWARE > Programming > Multiple copy batch file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|