Very handy Ray - so I tweaked it a bit and made it into a UDF back_adb_01082017.txt
Code:
FUNCTION back_adb AS C (vZip AS C = "")
'DESCRIPTION: Backup script by Ray Hendler converted to UDF by Robin Q
'can call from a button script and optionally use the return value to open the zip or copy the file to a usb stick
if vZip = "" then
'give the back up file the same name as the ADB with a date & Zip extension in current adb directory
vZip = strtran(a5.Get_Name(),".adb",chr(95)+cdate(date())+".zip")
'NOTE: May need to use HOME key to place cursor at beginning of file name when dialog opens
vZip = ui_get_file("Backup Zip File","Zip files (*.zip)",vZip)
if vZip = "" then
'user cancelled
end
end if
end if
ii=0 'COUNT THROUGH ONLY REGISTERED TABLES IN CURRENT DB FOLDER
progresspercent(1)
tblname=:a5.Table_Enum("",8)
while (tblname <> "")
ii=ii+1
if :a5.Get_Path()$tblname
FILE.ZIP(vZip,tblname)
tbln=strtran(tblname,".dbf",".fpt")
FILE.ZIP(vZip,tbln)
tbln=strtran(tblname,".dbf",".cdx")
FILE.ZIP(vZip,tbln)
end if
tblname=:a5.Table_Enum(tblname,8)
progresspercent(ii/ii*100)
end while
progresspercent(100)
back_adb = vZip
END FUNCTION
Bookmarks