Can someone please help me write a batch file to backup my PC?

Status
Not open for further replies.

lamensterms

Posts: 72   +0
Hey guys,
Im trying to write a batch file that will allow me to backup one of my HDDs in my PC. Im running vista, and i have 2 internal HDDs. One is C: which has the OS and all programs installed on it, and the second internal HDD has all my other gear (music, photos, videos, illustrator files, CAD files, etc).

I recently purchased a 500GB external HDD and have been backing up using vistas utility, but i dont like the way it archives all the data into .zip/.rar files and such. I would like to maintain the directory structure from my internal HDD, and back it up to the external. Another thing is...ive created 2 partitions on my external HDD (one for the PC backup - NTFS - about 300GB, and the other to use as extra storage for my PS3 - FAT32 - about 150GB). I used Paragon Partition Manager to do this and apparently that was a success.

So ive written a batch file as follows:

****************************

xcopy /e /d /v /y F: H:\BackUp\F

pause

***************************

which i got from this site http://www.ahuka.com/backup/backup3.html

i tested the batch file on a single smalled folder from my F: and it worked well. But when i tried to backup my entire F:, which is about 250GB, it runs through the command cycle and appears to complete correctly, but when i look on my H:(external) there are no files or anything, and 50GB has been used (rather than an expected 250GB)

is there a problem with the batch file? or an issue with the way i have partitioned and formatted the external drive?

or something more sinister...?

any help is much appreciated.

thanks a lot guys.
 
Hi

I tried this once with an external drive plugged into my server, i had about 55gb of MP3's to copy over as a backup.

I wrote a similar batch file to yours and scheduled a task to run it.

It didnt work and only copied a small portion of the files.

Last night i tried backing up 55gb of files from one external drive to another using the standard cut and paste procedure, it kept failing, i figured that the external USB drives just couldnt cope with such a large data shift all at once.

I then did cut and paste on sections of the files until all copied over OK.

Suggestion....

Do your copying in blocks of 20GB using cut and paste. I know its slower and not what you want.

Maybe someone on here can suggest if its the USB side of things that is causing the problem.

Regards
 
thank you for your suggestion Ididmyc600, if i cant get it to cope with the bulk backup, i might have to walk that path you did.

i just noticed that the backup cycle isnt completeing correctly though, it gets to a point then says "insufficient memory", this is strange seeing as though im tyring to copy about 230GB onto a 300GB partition.

if the problem is as simple as the USB drives not being able to deal with large transfers.... would it be possible for me to do the first backup with the copy/paste bit-by-bit method, then use the batch file to do the weekly backups, only backing-up changed/new files and the like?

*****EDIT*****

i just google my insufficient memory issue and found this: http://www.ctunion.com/node/114

so ill give that a go and return with the results.

Cheers.
 
Maybe i missed something during my quick read through the post, if so please calrify.

So it's an interesting programming excersize but when it comes down to something you must rely on for your backups (which are critical), why are you writing your own? Here;s two things to consider:

1. Get all the functionality of a backup product like Acronis True Home Image. Clone your disk, create disk image backup as well as file backups. Have the option of disk image recovery as well as file recovery. for $50 (i think yoiu may still find it for $40)

2. You want to give up some backup functionality because whatever you use must be absolutely free??? If that's what you insist, at least look at Drive Image XML
 
hi LookinAround, the only reason im writing my own batch file for backups is because it was suggested to me, and i was told it was easy and convenient (er...right). I had a look around for some software that would backup my files but maintain my folder structure and didnt really have much luck sorting through the different developers sales pitches, so when i was talking to a friend about it, they suggested a batch file.

id be quite happy to spend $50 or so on some software that would backup the way i have mentioned, so if you have any more suggestions of any titles, that would be much appreciated.

but i would still like to try and sort out the issues im having with the batch file, just for the exercise, as you say.

thanks a lot.
 
i think you;ll find Acronis True Image Home v11 does everything you want and much more, incl

1. Backup your files and folders retaining current structure
2. When you do a full backup, it doesn't simply backup files and folders but creates a "snapshot" of your entire disk as an image. Should you have disk media failure or a virus wipes everything out, Acronis can re-recreate your entire old disk image again (after you do any disk repair, replace, etc. as needed). point being its just a few mouse clicks to recover your entire disk as it was

Normally, $49.99, here's an electronic coupon so you pay $39.99 PLUS it comes with 15day free trial. LOL i should get a commission.. but it is a good product.
 
lamensterms said:
****************************

xcopy /e /d /v /y F: H:\BackUp\F

pause

***************************

Try:
xcopy "source" "destination" /h /k /q /y

/h : Copies files with hidden and system file attributes. By default, xcopy does not copy hidden or system files.

Also, instead of creating the new directory, you can just add the /i parameter to xcopy and it will create the directory if it does not exist
 
hi guys i ended getting the backup to work by using robocopy, the mir switch and a few others. this worked well for the first backup, but im not sure how it will go for my next backup, only backing up new/changed files.

LookinAround, thanks for your help i will probly end up using that utility you suggested, unless someone can enable me to invest more confidence in the batch files (at the moment i dont trust it much).

kimsland, now that i have completed the initaial backup, i will try using the command you supplied, and see if i can use that as my weekly backup tool....if not, Acronis True Image Home here i come.

thanks a lot everyone.

*******EDIT********

apparently robocopy will only backup new/changed files, by default. http://www.ss64.com/nt/robocopy.html

so hopefully i can stick with it.
 
Status
Not open for further replies.
Back