[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

I have two batch files, 1 that backs up to second HDD and second backs up to networked PC, how do I add timing and dates to the sequence?

Posted on 2005-04-18
7
Medium Priority
?
218 Views
Last Modified: 2010-04-14
The first one backs up to my second HDD:

@echo off
xcopy "C:\Documents and Settings\Administrator\Desktop" F:\bkup\desktop /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\Favorites" F:\bkup\favorites /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\My Documents" F:\bkup\mydocs /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\Local Settings\Application Data\Identities" F:\bkup\express /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft" F:\bkup\outlook /E /H /C /D /Y

This one backs up to a mapped drive on another PC on the network:

@echo off
xcopy "C:\Documents and Settings\Administrator\Desktop" G:\cgfhgjmk\desktop /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\Favorites" G:\cgfhgjmk\favorites /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\My Documents" G:\cgfhgjmk\mydocs /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\Local Settings\Application Data\Identities" G:\cgfhgjmk\express /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft" G:\cgfhgjmk\microsoft /E /H /C /D /Y


Now, currently I have both of these in my start menu so that every time the PC starts they update, however what if I wanted 5 days worth of backup? is it possible to build this into the code?

I have some downloaded software that will keep up to 14 days data so long as there is enough storage space, but id like to use this proceedure as it enables me to continue to use my pc as it seems a lot lower on PC useage than most backup programs.

NB: I am very new to this, took me all last night to grasp the above code so be gentle with me please.

Thanks you in advance,

Mat
0
Comment
Question by:auraorange
7 Comments
 
LVL 5

Assisted Solution

by:dr_binks
dr_binks earned 400 total points
ID: 13810549
you could use 'ntbackup' (run it from the command prompt), you can select to files and folders you want to back up and you can also backup thhe system state.
You can select the destination to save the backup to.. like a mapped drive and also create rescue discs.
 Also you can select incrimental backup and schedual it for every 5 days.

hope that helps

~Binks
0
 
LVL 17

Assisted Solution

by:Eagle6990
Eagle6990 earned 400 total points
ID: 13810655
You want it to only run every 5 days?  

If that is so then you can use the builtin scheduler.

Start>Programs>Accessories>System Tools>Scheduled Tasks.

Set each of your batch files up as a scheduled task to run whenever you want.
0
 
LVL 16

Accepted Solution

by:
craylord earned 1200 total points
ID: 13811055
It sounds like you just want five days of data history. Adding the lines below will rename the folders in the proper order as backups occur. The fifth day is just overwritten by renaming the folder from the previous backup. Simple enough? :)

@echo off
ren f:\bkup4 f:\bkup5
ren f:\bkup3 f:\bkup4
ren f:\bkup2 f:\bkup3
ren f:\bkup f:\bkup2
xcopy "C:\Documents and Settings\Administrator\Desktop" F:\bkup\desktop /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\Favorites" F:\bkup\favorites /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\My Documents" F:\bkup\mydocs /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\Local Settings\Application Data\Identities" F:\bkup\express /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft" F:\bkup\outlook /E /H /C /D /Y

@echo off
ren g:\cgfhgjmk4 g:\cgfhgjmk5
ren g:\cgfhgjmk3 g:\cgfhgjmk4
ren g:\cgfhgjmk2 g:\cgfhgjmk3
ren g:\cgfhgjmk g:\cgfhgjmk2
xcopy "C:\Documents and Settings\Administrator\Desktop" G:\cgfhgjmk\desktop /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\Favorites" G:\cgfhgjmk\favorites /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\My Documents" G:\cgfhgjmk\mydocs /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\Local Settings\Application Data\Identities" G:\cgfhgjmk\express /E /H /C /D /Y
xcopy "C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft" G:\cgfhgjmk\microsoft /E /H /C /D /Y
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 16

Expert Comment

by:craylord
ID: 13811078
And if you wanted 14 days worth of data backup, then just keep adding the ren lines up until you hit 14!
0
 
LVL 2

Author Comment

by:auraorange
ID: 13811284
thanks craylord, that just what I am after.

When I created my initial backup (as i posted above)

I created each folder individually on my destination drive.

Will I have to manually create 5 folders for each backup sequence or will the folders be generated automatically?

E.g. create:

cgfhgjmk1 containing favorites, mydocs, Microsoft, desktop, express
cgfhgjmk2 containing favorites, mydocs, Microsoft, desktop, express
cgfhgjmk3 containing favorites, mydocs, Microsoft, desktop, express
cgfhgjmk4 containing favorites, mydocs, Microsoft, desktop, express
cgfhgjmk5 containing favorites, mydocs, Microsoft, desktop, express

Thanks,

Mat
0
 
LVL 2

Author Comment

by:auraorange
ID: 13811292
what if due to disk space i wanted to created 5 backups, over a 10 day period?

is this is getting too confusing, then leave this bit...

Thanks again
0
 
LVL 16

Expert Comment

by:craylord
ID: 13812572
The folders will be created automatically. no need to create them.

But your 10 day request got me thinking, when it comes to disk space, 5 backups is 5 backups worth of information. whether it happens in 10 hours, 5 days or 10 days. If every 5th backup is overwritten you're data volume will generally stay about the same after the initial fifth copy. Unless you do some massive file downloading or editing. I will look into the every 10 day thing tomorrow.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
LinkedIn blogging is great for networking, building up an audience, and expanding your influence as well. However, if you want to achieve these results, you need to work really hard to make your post worth liking and sharing. Here are 4 tips that ca…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month18 days, 18 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question