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!

Fast backup of all files in directory to ZIP-file

Utility Program

Fast backup of all files in directory to ZIP-file

by  broekhuis  Posted    (Edited  )
There is an easy way to backup your daily work! I usually backup the directory with my application once a day.

I have now automated this process so that the backup file (ZIP-file) is stored in a subdirectory "backup". The filename is determined automatically and is made from the date in ISO format, for example the backup of February 24 2004 becomes "20040224.ZIP". Further the backup is extremely fast! You can for example run the backup program in each directory with valuable data!

The basis is the free XZIP.DLL component (see www.XStandard.com for download). I modified the code from one of the threads on this forum in order to make the code backup the way subscribed above. You can copy the code below and paste it into a prg, which can be used in a project, compiled, etc..

set century off
set date to italian
PUBLIC objFile
objFile = ""

oZip = CreateObject("XStandard.Zip")
oFS = CREATEOBJECT("Scripting.FileSystemObject")
lcZipName = SYS(2003)+"\backup\"+DTOS(DATE())+".zip"

WAIT WINDOW "Starting backup..." NOWAIT

For each objFile in oFS.GetFolder(SYS(2003)).Files
oZip.Pack(objFile.Path,lcZipName)
ENDFOR

WAIT WINDOW "Backup " + ALLTRIM(DTOS(DATE())) + ".ZIP ready!" timeout(1)
quit

Regards,

Gerrit
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top