|
Answer» Please forgive my ignorance.
I need a batch file that will:
-Format a drive as NTFS (in this case it will be external drive "Z:"). -copy all data and file structure from "x:" and "y:" to that drive.
This is going to be used as a backup solution for about 200gb of data. I will be using four external USB Drives to backup my network data and will rotate each drive once a week so I will ultimately have a four week backup.This will work on a XP machine:
Code: [Select] @echo off format z: /fs:NTFS /v:Backup xcopy x: z: /s /e /h xcopy y: z: /s /e /h
Notes.
1. Use xcopy /? from the command prompt to check what switches are valid on your machine
2. Not all devices can be formated NTFS
3. The tree structure of both X and Y will be maintained on Z. Ensure that this does not create conflicts or overwrites.
Hope this helps. THANKS for the help. I copied and pasted into notepad as a batch.
On execution a dos window opens:
The type of the file susyem is NTFS. Enter Current Volume Label for Drive z:
After I type "Backup" at the prompt I get:
WARNING, ALL DATA ON NON-REMOVEABLE DISK DRIVE I: WILL BE LOST! Proceed with Format (y/n)?
If I could get "Backup" and "Y" enter to show up I would be golden.
I am trying to make this as AUTOMATED as possible so nobody can screw it up since I will not be the person running the process.
Thanks for the help.I see you have found the many joys of batch programming. Now it's time for some smoke and mirrors.
Code: [Select] @echo off format z: /fs:NTFS /v:Backup < RESPONSE.txt xcopy x: z: /s /e /h xcopy y: z: /s /e /h echo *** Backup Complete ***
Create a separate file called response.txt. First line is the current volume label of Z. Second line is the letter Y.
response.txt: Code: [Select] Backup Y
Do a directory on the Z drive to get the current label.
Good luck. Here is the text of my functioning batch, thanks to you guys.
echo format i: /q /fs:NTFS /v:Backup < Response.txt I: MkdIR i:\d MkdIR i:\g mKdIR i:\h mKdIR i:\m mKdIR i:\P mKdIR i:\s mKdIR i:\v mKdIR i:\x xcopy d: i:\d /e /y xcopy g: i:\g /e /y xcopy h: i:\h /e /y xcopy m: i:\m /e /y xcopy p: i:\p /e /y xcopy s: i:\s /e /y xcopy v: i:\v /e /y xcopy x: i:\x /e /y
The response text is: Backup Y
Everything is working perfectly with the exception of G:
The batch creates the directory and copies the info from Drive G: to directory i:\G but sometime during the process the directory disappears, though the batch continues to show information being copied to that folder.
Doing some math using the properties window the 10gb that should be there is but the folder is gone.
Most likely just a fluke with this computer. I am testing all this on my workstation and will try it on my server later.
thanks for the help.
|