Sign in to follow this  
Followers 0
John-Paul

Restore & Recover

6 posts in this topic

I have created a script that backs up specified directories and contents to a generic location and subsequently adds a date and time stamp to the actual backup.

My question is now that I have done this how can I restore the last saved version.

e.g. L:\DVD-02\_BACKUPS\Favorites_Full\_13.06.2005_01.12

The above being the actual directory the favorites are placed in.

Heres what i have used to back up, not complete but the main processes.

CODE:

Dim $LogDate

$sDate = @MDAY & "." & @MON & "." & @YEAR

$LogDate = $sDate

; Added: Sun 12/June/2005

; Refer to date notes.

Dim $LogTime

$sTime = @HOUR & "." & @MIN

$LogTime = $sTime

CODE:

$sCopyTo = "L:\DVD-02\_BACKUPS\MailWasherPro.Logs" & "_Full\" & "_" & $LogDate & "_" & $LogTime

$sSource = "C:\Documents and Settings\" & @UserName & "\Application Data\MailWasherPro"

$ScriptDir = @ScriptDir

$VRScript = @ScriptName

$ScriptFull = @ScriptFullPath

CODE:

If FileExists($sCopyTo)= 0 Then

MsgBox(4096,"Error","Specified " & $sCopyTo & " directory does not exist!",2)

NewDir()

EndIf

CODE:

Func CopyFolder($Folder1, $Folder2)

Local $ProcID

$ProcID = DirCopy($sSource, $sCopyTo, 1)

ProgressOn("Mailwasher Pro Backup", "")

$origfilesize = DirGetSize($Folder1)

Do

$copyfilesize = DirGetSize($Folder2)

$MBcopy = dirGetSize($Folder2) / 1024 / 1024

$percent = $copyfilesize / $origfilesize * 100

$decimalplace = Round ($percent)

$decimalplaceMBcopy = Round ($MBcopy)

ProgressSet ($percent, $decimalplace & "% " & "(" & _

$decimalplaceMBcopy & ") Mb has been copied.")

Sleep(500)

Until NOT ProcessExists($ProcID)

ProgressOff ()

$copyfilesize = DirGetSize($Folder2)

$MBorig = dirGetSize($Folder1) / 1024 / 1024

$decimalplaceMBorig = Round ($MBorig)

CODE:

Func NewDir()

DirCreate($sCopyTo)

MsgBox(0, "Greetings", "MailWasherPro backup directory has just been created!",2)

EndFunc

How to now get a restore to work based on say the last backup.

Any ideas?

jp

Share this post


Link to post
Share on other sites



Save the valued to an Ini file, or the registry, and read them upon execution of your script.

Look at IniRead(), IniReadSection (), IniReadSectionNames(), RegRead () and RegWrite() in the help file.


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

Save the valued to an Ini file, or the registry, and read them upon execution of your script.

Look at IniRead(), IniReadSection (), IniReadSectionNames(), RegRead () and RegWrite() in the help file.

<{POST_SNAPBACK}>

That is exactly how I would do it too. Or you could have it write the name of the backups to a plain text file. The last one on the list would be your last backup. But an ini should be easier to manage.

Share this post


Link to post
Share on other sites

Yes Ini are alot easier to handle and the functions are already there for you. If you just use a plain text file you'll have to have a value on each line or have some way to determine when one ends and another starts. Then you would have to create your own functions to read the right part of the text file to get the desired information.


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

Save the valued to an Ini file, or the registry, and read them upon execution of your script.

Look at IniRead(), IniReadSection (), IniReadSectionNames(), RegRead () and RegWrite() in the help file.

<{POST_SNAPBACK}>

Thanks.

Will do a bit of research and get back when I have something.

The other comments support your INI approach and I had not thought of doing it that way before, is this a good foundation to use with say any type of process that requires a later form of validation. Not just the mere fact that it has occurred but providing an audit trail if you like.

Hope that makes sense.

jp

Share this post


Link to post
Share on other sites

Well thanks to all for the pointers.

The INI file solution works wonders and I have now a working restore process. Bit long winded to add all the little snippets here however a big thanks to AutoIT help file and those in the group for the great amount of data to sift through and use.

jp

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0