You are here

Script Posting a backup script that may be usefull for others

1 post / 0 new
RonTon
Offline
Last seen: 11 years 1 week ago
Joined: 2013-07-05 12:17
Script Posting a backup script that may be usefull for others

-- Win7 / Vista / xp Backup script. Created 2013 06
-- Backup 5 generation's

-- Rotate backup
function rotate (Prefix)
delete (Target .. Prefix .. [[-5.7z]])
rename (Target .. Prefix .. [[-4.7z]], Target .. Prefix .. [[-5.7z]])
rename (Target .. Prefix .. [[-3.7z]], Target .. Prefix .. [[-4.7z]])
rename (Target .. Prefix .. [[-2.7z]], Target .. Prefix .. [[-3.7z]])
rename (Target .. Prefix .. [[.7z]], Target .. Prefix .. [[-2.7z]])
end

--Rooling Multi backup script.
--Get user name
user = os.getenv("USERNAME") --User name
home = os.getenv("HOMEPATH") --User directory
SDrv = os.getenv("HOMEDRIVE") --Target drive
TDrv = [[Z:]] --Target drive

--Create source
--Maildir =SDrv .. home .. [[\Local Settings\Application Data\Microsoft\Outlook\]] -- Outlook 2003
--Maildir =SDrv .. home .. [[\AppData\Local\Microsoft\Windows Mail\]] -- Winmail
Maildir = SDrv .. home .. [[\AppData\Local\Microsoft\Windows Live Mail\]] -- Live mail
Docdir = SDrv .. home .. [[\Documents\]] -- Outlook .pst stored in document from version 2007
Favdir = SDrv .. home .. [[\Favorites\]] -- Nice to have for some
-- Just add more as you need them. Remeber rotate and backup

--Create target
Target = TDrv .. [[\backup\]] .. user .. [[\]]
Suffix = [[.7z]]

-- Prepare for rotate
Mailfile = Target .. [[E-post]] -- Rotate create new suffix
Docfile = Target .. [[Document]]
Favfile = Target .. [[Favoriter]]

--Rotate generation
rotate(Mailfile)
rotate(Docfile)
rotate(Favfile)

-- Prepare for backup
Mailfile = Target .. [[E-post]] .. Suffix -- Mail backup
Docfile = Target .. [[Document]] .. Suffix -- My dock backup
Favfile = Target .. [[Favoriter]] .. Suffix -- Favorite backup

--Do Backup
-- Source, Target, Type, Zip, No password, Not a test, Soliid ?
backup ({Maildir}, Mailfile, [[Complete]], [[7-Zip]], 3,{password = false, test = false, solid = true},"")
backup ({Docdir}, Docfile, [[Complete]], [[7-Zip]], 3,{password = false, test = false, solid = true},"")
backup ({Favdir}, Favfile, [[Complete]], [[7-Zip]], 3,{password = false, test = false, solid = true},"")