This is the util I put together for them, just in case its of any use to anyone else out there;
#SingleInstance, off
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
; Gui Create Section
gui, font, s15, Arial
Gui, Add, Text, x17 y12 w440 h30, Shane's Backup Util
gui, font, s8, Arial
Gui, Add, Edit, vedtsource x16 y57 w300 h20, %SourceName%
Gui, Add, Button, vbtnsource gSOURCESELECT x356 y57 w100 h20, Source Select
Gui, Add, Edit, vedttarget x16 y87 w300 h20, %TargetName%
Gui, Add, Button, vbtntarget gTARGETSELECT x356 y87 w100 h20, Target Select
Gui, Add, Text, vWorkArea x16 y130 w440 h70, Ready!
Gui, Add, Progress, vProg1 -smooth C808080 x16 y220 w440 h10, 0
Gui, Add, CheckBox, gWARNING vReplace x16 y240 w180 h20, Select to Replace Existing Files
Gui, Add, Button, vbtnbackup gBACKUP x256 y240 w100 h30, Run Backup
Gui, Add, Button, vbtnclose gGuiClose x366 y240 w90 h30, Exit App
Gui, Show, x131 y91 h280 w477, Shane's Backup Util
Return
SOURCESELECT:
{
; Select a Source folder - Button on Gui
SetControls( "disable" )
GuiControlGet, Tempsource,,edtsource
FileSelectFolder, SourceName, *%Tempsource% , 3, Select a Source Folder for your backup.
Sleep, 250
Tempsource=
SetControls( "enable" )
GuiControl, , edtsource, %SourceName%
Return
}
TARGETSELECT:
{
; Select a Target folder - Button on Gui
SetControls( "disable" )
GuiControlGet, Temptarget,,edttarget
FileSelectFolder, TargetName, *%Temptarget% , 3, Select the destination you would like to backup to.
Sleep, 250
Temptarget=
SetControls( "enable" )
GuiControl, , edttarget, %TargetName%
Return
}
BACKUP:
{
GuiControl, , WorkArea, Backup Running...
FileDelete, c:\sbprob.txt
GuiControlGet, SourceName, ,edtsource
GuiControlGet, TargetName, ,edttarget
;Check for and remove a trailing \ from SourceName
StringRight, LastChar, SourceName, 1
if LastChar = \
{
StringTrimRight, SourceName, SourceName, 1
GuiControl, , edtsource, %SourceName%
}
;Check for and remove a trailing \ from TargetName
StringRight, LastChar, TargetName, 1
if LastChar = \
{
StringTrimRight, TargetName, TargetName, 1
GuiControl, , edttarget, %TargetName%
}
IfNotExist, %SourceName%
{
MsgBox, 0, Problem, The Source folder you have specified does not exist
Return
}
IfNotExist, %TargetName%
{
MsgBox, 0, Problem, The Target folder you have specified does not exist
Return
}
SetControls( "disable" )
GuiControlGet, Replace, ,Replace
;Count how many files are to be copied by this process
SourceCount=0
Loop, %SourceName%\*.*, 0, 1
{
SourceCount++
}
;Calculate the percentage to progress the bar by for each stage
peradd=%SourceCount%
peradd:=100/peradd
; Create the folder structure at the Destination if it does not already exist
Loop, %SourceName%\*.*, 2, 1
{
Stringreplace, foldername, A_LoopFileFullPath, %SourceName%
FileCreateDir, %targetName%\%foldername%
}
; Perform the copy of files
progadd=0
Loop, %SourceName%\*.*, 0, 1
{
Stringreplace, filename, A_LoopFileFullPath, %SourceName%
progadd:=progadd+peradd
GuiControl, , Prog1, %progadd%
;Check for and remove a Starting \ from fileName
StringLeft, FirstChar, filename, 1
if FirstChar = \
{
StringTrimLeft, filename, filename, 1
}
; Perform a basic copy not normally overwrite files - Also sets the Creation time to match the sourcefile
FileCopy, %SourceName%\%filename%, %TargetName%\%filename%, %Replace%
IfEqual, Errorlevel, 0
{
FileGetTime, stime, %SourceName%\%filename%, C
FileSetTime, %stime%, %TargetName%\%filename%, C, 0, 0
FileSetAttrib, -A, %SourceName%\%fileName%, 0, 0
GuiControl, , WorkArea, Backup Running...`nCopying %SourceName%\%filename% to %TargetName%\%filename%
Continue
}
; Check if the file has been modified (Archive bit set?)
FileGetAttrib, abit, %SourceName%\%filename%
IfInString, abit, A
{
; Check if the files are the same (created at the same time)
FileGetTime, SourceTime, %SourceName%\%filename%, C
FileGetTime, TargetTime, %TargetName%\%filename%, C
IfEqual, SourceTime, %TargetTime%
{
FileCopy, %SourceName%\%filename%, %TargetName%\%filename%, 1
IfNotEqual, Errorlevel, 0
{
FileAppend, Not Copied %SourceName%\%filename%`n, c:\sbprob.txt
Continue
}
FileGetTime, stime, %SourceName%\%filename%, C
FileSetTime, %stime%, %TargetName%\%filename%, C, 0, 0
FileSetAttrib, -A, %SourceName%\%filename%, 0, 0
GuiControl, , WorkArea, Backup Running...`nCopying %SourceName%\%filename% to %TargetName%\%filename%
Continue
}
; Check to see if this filename includes an extension
StringTrimRight, filenametemp, filename, 3
StringRight, LastChar, filenametemp, 1
IfEqual, LastChar, .
{
StringLen, len1, filename
len1 :=len1-4
StringTrimLeft, fext, filename, %len1%
StringTrimRight, fname, filename, 4
FileMove, %SourceName%\%filename%, %SourceName%\%fname%%A_DD%%A_MM%%A_YYYY%%fext%, 1
FileCopy, %SourceName%\%fname%%A_DD%%A_MM%%A_YYYY%%fext%, %TargetName%\%fname%%A_DD%%A_MM%%A_YYYY%%fext%
IfNotEqual, Errorlevel, 0
{
FileAppend, Not Copied %SourceName%\%fname%%A_DD%%A_MM%%A_YYYY%%fext%`n, c:\sbprob.txt
Continue
}
FileGetTime, stime, %SourceName%\%fname%%A_DD%%A_MM%%A_YYYY%%fext%, C
FileSetTime, %stime%, %TargetName%\%fname%%A_DD%%A_MM%%A_YYYY%%fext%, C, 0, 0
FileSetAttrib, -A, %SourceName%\%fname%%A_DD%%A_MM%%A_YYYY%%fext%, 0, 0
GuiControl, , WorkArea, Backup Running...`nCopying %SourceName%\%fname%%A_DD%%A_MM%%A_YYYY%%fext% to %TargetName%\%fname%%A_DD%%A_MM%%A_YYYY%%fext%
Continue
}
FileMove, %SourceName%\%filename%, %SourceName%\%filename%%A_DD%%A_MM%%A_YYYY%
FileCopy, %SourceName%\%filename%%A_DD%%A_MM%%A_YYYY%, %TargetName%\%filename%%A_DD%%A_MM%%A_YYYY%
IfNotEqual, Errorlevel, 0
{
FileAppend, Not Copied %SourceName%\%fname%%A_DD%%A_MM%%A_YYYY%`n, c:\sbprob.txt
Continue
}
FileGetTime, stime, %SourceName%\%fname%%A_DD%%A_MM%%A_YYYY%, C
FileSetTime, %stime%, %TargetName%\%fname%%A_DD%%A_MM%%A_YYYY%, C, 0, 0
FileSetAttrib, -A, %SourceName%\%filename%%A_DD%%A_MM%%A_YYYY%, 0, 0
GuiControl, , WorkArea, Backup Running...`nCopying %SourceName%\%fname%%A_DD%%A_MM%%A_YYYY% to %TargetName%\%fname%%A_DD%%A_MM%%A_YYYY%
}
}
IfExist, c:\sbprob.txt
{
MsgBox, 0, Problems Occured, Not all files were copied succefully`n`nYou will now see a notepad window displaying problem files`n`nYou must close this window to continue.
RunWait, notepad c:\sbprob.txt, ,Max
}
SetControls( "enable" )
GuiControl, , WorkArea, Ready!
Return
}
GuiClose:
ExitApp
WARNING:
GuiControlGet, Replace, ,Replace
IfEqual, Replace, 1
{
MsgBox, 0, Beware, This option should only usually be used for your first backup using this product.`nUsing this option at any other time could cause permenant loss of data!
}
Return
SetControls( state )
{
GuiControl, %state%, btnsource
GuiControl, %state%, btntarget
GuiControl, %state%, btnbackup
GuiControl, %state%, btnclose
}




