At least you tested it and saw the problem, but I'd be willing to
bet there are users out there who simply depended on the settings because
they make you think you should get an over-write warning! In my case the
Archives are made automatically when ever a certain action takes
place...usually just before shutdown, and because the user data is so
important, I wanted to keep at least one or two previous Archives available
even if it happened on the same day. So I just rename the Archive found in
the directory and then let it go ahead.
from Robert Meek dba Tangentals Design CCopyright 2006
"When I examine myself and my methods of thought, I come to the conclusion
that the gift of Fantasy has meant more to me then my talent for absorbing
positive knowledge!"
Albert Einstein
My approach is to append a suffix letter to the MONDDYY name base, and then
display the candidate name in an edit box, in case the user wants to change
it. The code is ridiculously simple:
Name := LeftStr (MonDDYY_HHMMSS (Now), 7);
Suffix := 'A';
While FileExists (EdFolder.Text + '\' + Name + Suffix + '.zip') and
(Suffix [1] in ['A'..'Z']) do
inc (Suffix [1]);
if not (Suffix [1] in ['A'..'Z']) then
Suffix := '';
EdFileName.Text := Name + Suffix;
Then, in the zip creating part, I simply enclose the whole thing in a try
... block
try
with Zip do begin // ZipForge
FName := EdFolder.Text + '\' + EdFileName.Text + '.zip';
FileName := Fname;
OpenArchive (fmCreate);
BaseDir := 'C:\WinACS\ACSData';
Password := Pwd;
AddFiles ('*.*');
CloseArchive;
end;
.....
If something goes wrong, I inform the user, and let him change the name and
try again. The only way it will get in trouble anyway is if he/she tries to
make more than 26 backups in one day, or he/she changes the name to
something already used.
Rainer
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi