Hi everyone,
I have followed on from Tom Cone's backup routine and my script creates a back up zip file and places it into a designated folder with a file name of username.zip The script will pause while the batch operation is active. If you set sys_shell to run minimised the user need not be aware of the operation. The script assumes that you have a copy of runtime PKzip located in your folder.
|=backslash
'The Zipper batch file is run by sys_shell()
echo
cls
del c:|MyFolder|*.zip
pkzip25 -add c:|Myfolder|Anyname.zip mytable.dbf '(or use*.dbf *.fpt * *.cdx)
del c:|Myfolder|dummy.txt
exit
'Create a dummy text file and the final line of the dos batch file will delete this.
Dim shared timer as n
timer=toseconds(time())
filename="C:|Myfolder|dummy.txt"
file_pointer=file.create(filename,FILE_RW_SHARED)
file_pointer.flush()
file_pointer.close()
If username="Your name here".OR.username="" then
ui_msg_box("You must","enter your name before proceeding")
END
ELSE
sys_shell("Zipper.pif",1) ' dos batch file deletes previous.zip files if any, creates a zipfile Anyname.zip
'and finally deletes dummy.txt file
END IF
'Check to see if dummy.txt exists, if false then I know batch has ended
filename="c:|myfolder|dummy.txt"
trace.writeln(filename)
WHILE file.exists(filename)
If toseconds(time())-timer>60 then
Exit while
End if
END WHILE
'Your script can safely continue now as per your choice
'this part will change the name of Roomlist.zip to username.zip then delete roomlist.zip
filename=chr(92)+rtrim(remspecial(username))+".zip"
file_copy("c:|myfolder|anyname.zip","c:|myfolder"+filename)
oldfile="c:|myfolder|anyname.zip"
file.remove(oldfile)
Michael
I have followed on from Tom Cone's backup routine and my script creates a back up zip file and places it into a designated folder with a file name of username.zip The script will pause while the batch operation is active. If you set sys_shell to run minimised the user need not be aware of the operation. The script assumes that you have a copy of runtime PKzip located in your folder.
|=backslash
'The Zipper batch file is run by sys_shell()
echo
cls
del c:|MyFolder|*.zip
pkzip25 -add c:|Myfolder|Anyname.zip mytable.dbf '(or use*.dbf *.fpt * *.cdx)
del c:|Myfolder|dummy.txt
exit
'Create a dummy text file and the final line of the dos batch file will delete this.
Dim shared timer as n
timer=toseconds(time())
filename="C:|Myfolder|dummy.txt"
file_pointer=file.create(filename,FILE_RW_SHARED)
file_pointer.flush()
file_pointer.close()
If username="Your name here".OR.username="" then
ui_msg_box("You must","enter your name before proceeding")
END
ELSE
sys_shell("Zipper.pif",1) ' dos batch file deletes previous.zip files if any, creates a zipfile Anyname.zip
'and finally deletes dummy.txt file
END IF
'Check to see if dummy.txt exists, if false then I know batch has ended
filename="c:|myfolder|dummy.txt"
trace.writeln(filename)
WHILE file.exists(filename)
If toseconds(time())-timer>60 then
Exit while
End if
END WHILE
'Your script can safely continue now as per your choice
'this part will change the name of Roomlist.zip to username.zip then delete roomlist.zip
filename=chr(92)+rtrim(remspecial(username))+".zip"
file_copy("c:|myfolder|anyname.zip","c:|myfolder"+filename)
oldfile="c:|myfolder|anyname.zip"
file.remove(oldfile)
Michael