Intro

Here is an easy AutoIt script that I use for basic users who need to automaticaly backup their datas to external drive. It backups current user Desktop, Downloads, Documents, Music, Pictures, Videos and Thunderbird folders.

Configuration

Instructions

Usage

Code

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\Downloads\Drive-Backup-icon.ico
#AutoIt3Wrapper_Outfile_x64=backup.exe
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Date.au3>
#include <MsgBoxConstants.au3>
# Role : Backup User and Thunderbird profile to Z:\BACKUP\YYYY
# Author : http://shebangthedolphins.net/
# Instructions  : 
# - Allocate backup drive to Z:
# - use  Aut2Exe to convert script to .exe file
# 1.0 first version
# 1.1 Create a YYYY folder to destination, automaticaly use UserName path

;separate hour and date
;source : https://www.autoitscript.com/autoit3/docs/libfunctions/_DateTimeSplit.htm
Local $aMyDate, $aMyTime
_DateTimeSplit( _NowCalc(), $aMyDate, $aMyTime)

;Date variable which will include current date
Local $Date

;if month is less than 10 we add 0 in front of the value
If $aMyDate[2] <h; 10 Then
	$aMyDate[2] = "0" & $aMyDate[2]
	EndIf

;if days are less than 10 we add 0 in front of the value
If $aMyDate[3] < 10 Then
	$aMyDate[3] = "0" & $aMyDate[3]
	EndIf

;We concatenate variables in order to have date value with this format : YYYY.MM.JJ
;$Date = $aMyDate[1] & "." & $aMyDate[2] & "." & $aMyDate[3]
;We only select YYYY (current year) value
$Date = $aMyDate[1]

;Get all drives letters
;https://www.autoitscript.com/autoit3/docs/functions/DriveGetDrive.htm
Local $aArray = DriveGetDrive($DT_ALL)

;Folders table which contain all folders we want to save
Local $SFolders[6]
$SFolders[0] = "Desktop"
$SFolders[1] = "Downloads"
$SFolders[2] = "Documents"
$SFolders[3] = "Music"
$SFolders[4] = "Pictures"
$SFolders[5] = "Videos"

    For $i = 1 To $aArray[0]
		;Backup only if Z: drive is found
		If StringUpper($aArray[$i]) == "Z:" Then
			For $element in $SFolders
				RunWait(@ComSpec & " /c " & 'robocopy "C:\Users\' & @UserName & '\' & $element & '" Z:\BACKUP\' & $Date & '\' & $element & ' /MIR /R:2 /W:2 /X /V /NP /LOG:Z:\BACKUP\log_' & $element & '.txt /TEE', "", @SW_MAXIMIZE)
			Next
			;Sauvegarde de Thunderbird
			RunWait(@ComSpec & " /c " & 'robocopy "C:\Users\' & @UserName & '\AppData\Local\Thunderbird" Z:\BACKUP\' & $Date & '\Thunderbird\Local /MIR /R:2 /W:2r /X /V /NP /LOG:Z:\BACKUP\thunderbird_Local.txt /TEE', "", @SW_MAXIMIZE)
			RunWait(@ComSpec & " /c " & 'robocopy "C:\Users\' & @UserName & '\AppData\Roaming\Thunderbird" Z:\BACKUP\' & $Date & '\Thunderbird\Roaming /MIR /R:2 /W:2r /X /V /NP /LOG:Z:\BACKUP\thunderbird_Roaming.txt /TEE', "", @SW_MAXIMIZE)
		EndIf
    Next
Licence Creative Commons
This websitehttp://shebangthedolphins.net is licensed to the public under a licence Creative Commons Attribution licence.
Contact :