Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automated backup???? 1

Status
Not open for further replies.

gussy1

Technical User
Dec 22, 2002
63
0
0
IE
Can anyone suggest an relatively easy way to do the following?

I have one 30Gb hard drive partitioned in two (10Gb and 20Gb).
There are three users on my system and each user has a backup folder on the D: (20Gb) drive.
I ask the users to backup there documents to this D: drive in case I have to restore an
image to the C: drive or re-install Windows or whatever.

Anyway, I want to automate this backup procedure as the users log off. I thought about a log-off script to check if any files in each users' My Documents folder has been modified and if and only if it has been modified since the last back-up or log-off, the modified file will be backed up to the D: drive.

I don't know how to do this easily and was wondering if anyone can help. Windows own backup program doesn't check for modifications so it will end up backing every doc and take up unneccessery space.


Cheers
gussy1
 
Here is a little batchfile I use for that purpose.
You can either make it manual or automatic.
My users, and myself, prefer the manual way, but that's each choice.
For manual, put a shortcut on the desktop.

This one assumes all data is in 'C:\My Documents' and all folders below. You can modify or add paths as you please, as well as the accompanying text messages.
-------------------------------
@echo off
c:
cdcd\mydocu~1
@echo on
@echo.
@echo.
@echo. Close all Applications.
@echo.
@echo. Press any key to start the backup.
@echo.
@echo.
@pause>nul
@cls
@xcopy *.* /i/d/f/h/r/k/s/e/v D:\Backup
@echo.
@echo.
@echo. All recently modified data copied.
@echo.
@echo. Your backup can be found in D:\Backup
@echo.
@echo.
@echo.
@echo. Press any key to finish.
@echo.

@pause>nul

--------------------
The solution is out there. [morning]
 
Another way to backup, which I use, is a free program that backsup, compresses and even password protects called "taskzip". It will do a full backup and/or incremental backup. It works on your machine or across a network. I've used this program for a year or more. It's completely automated too!

Unfortunately I don't believe it works as a shut down script. Unlike marcs41 where you could (with modification) set it up easily to do so.

However this will do much more once it is setup. You can schedule it to do full backups daily, weekly or monthly with incremental backups in between. It opens in any unzipping program (or it can be set to not zip and leave the files as they are). You can easily add new "tasks" with out editing any scripts or files - an all point and click interface.

You could easily set this up to run daily (it run out of the task bar automatically at lunch time) while backing up all users documents, files, folders or what have you.

This has proven itself very useful on more than one occassion. I set this up on my network to backup several systems without any noticable performance degradation on the system being backed up.

If you or anyone else are interested goto:


Cheers
 
Hey Marcs41,

I am just starting use batch files so am still not totally familiar with things like folder options (ie where you have "/i/d/f/h/r/k/s/e/v").

Would there be a way to modify your batch file to copy only those modified after a certain date?

Thanks in advance,

-Sean
 
Hmm, I guess so, I'll have to check.
What are your date-time formats? [sub]If 'something' 'somewhere' gives 'some' error, excpect random guesses or no replies at all. Please specify details.
Free Tip: The F1 Key does NOT destroy your PC! - Marc
[/sub]
 
/D:m-d-y Copies files changed on or after the specified da
If no date is given, copies only those files whos
source time is newer than the destination time.

that's from the Xcopy help: xcopy /?

so wouldn't it be only copying the newer files by default?
 
That's what it does as it is, only new AND modified files.
The date format can vary, d-m-y or m-d-y or d-m-y etc..., that's why I asked info on that. [sub]If 'something' 'somewhere' gives 'some' error, excpect random guesses or no replies at all. Please specify details.
Free Tip: The F1 Key does NOT destroy your PC! - Marc
[/sub]
 
Hi again - I've tried looking this up on my own but have failed. I wanted to modify the above solution so that I don't always have to manually change the date (criteria for which files to xcopy).

For the following code:
set dd=%date%
@xcopy *.* /i/d:%dd%/f/h/r/k/s/e/v M:\Bckp_%dd%

Would it be possible to somehow write:
set dd=%date%-7days
(I know it's the wrong syntax - in MSAccess I would write something like: DateAdd("d", -7, Now())

Other possibilities that I thought of (but am not familiar enough with the limitations of batch files) are 1) to prompt for a date 2) or (prob the best one) somehow store when the last time the batch was run and then I could use the date and time.

Sorry - I know that's alot of info - I don't expect complete solutions, just a point in the right direction.

Any help would be greatly appreciated!,

-Sean
 
Ok, yippiekyyay, I spent some tim eon this one, but is was a challenge, so here you go.
Repost of modified batch file.
Assumes all data is in 'C:\My Documents' and all folders below. You can modify or add paths as you please, as well as the accompanying text messages.

BEFORE use, make a file LASTDATE.TXT with the last date DD/MM/YY in it, for example 02/04/03 .
To test the format DDMMYY, open a cmd and type date /T

OK, here it is.


@echo off
Set LASTDATE=LASTDATE.TXT
Set PARSEARG="eol=; tokens=1,2,3,4* delims=/, "
For /F %PARSEARG% %%j in (%LASTDATE%) Do SET YYMMDD=%%l%%k%%j
DATE /T > %LASTDATE%
c:
cdcd\mydocu~1
@echo on
@echo. Close all Applications.
@echo.
@echo. Press any key to start the backup.
@pause>nul
@cls
@xcopy *.* /i/d/f/h/r/k/s/e/v MD:\Bck_%YYMMDD%
@echo.
@echo. All recently modified data copied.
@echo.
@echo. Your backup can be found in M:\Bck_%YYMMDD%
@echo.
@echo. Press any key to finish.
@pause>nul


Anything else ? ;-)
[sub]If 'something' 'somewhere' gives 'some' error, excpect random guesses or no replies at all. Please specify details.
Free Tip: The F1 Key does NOT destroy your PC! - Marc
[/sub]
 
Hold on, a typo:

@xcopy *.* /i/d/f/h/r/k/s/e/v MD:\Bck_%YYMMDD%
should be
@xcopy *.* /i/d/f/h/r/k/s/e/v M:\Bck_%YYMMDD%
[sub]If 'something' 'somewhere' gives 'some' error, excpect random guesses or no replies at all. Please specify details.
Free Tip: The F1 Key does NOT destroy your PC! - Marc
[/sub]
 
Thanks Marcs41 - I really appreciate it!

I was surprised to see a For loop - batch files can be more powerful then I realized.

Thanks again,

-Sean
 
You're welcome.

Keep us posted of the usefulness and if it works ok.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top