PDA

View Full Version : Variable+name.zip


Bruce
03-24-2007, 01:31 PM
How would one add a variable to a zip file that already has a name?

example: date_result = System.GetDate(DATE_FMT_US);

Zip.Add(_DesktopFolder.."\\date_result mdbbackup.zip", {"AutoPlay\\Docs\\*.enc"}, true, "", 9, ZipCallBack, true);

RizlaUK
03-24-2007, 01:43 PM
if you want to add files to a already existing zip just add the files without the variable then rename the zip when the zip.add is finished useing the variable

put in some error checking to make sure the file was added b4 renaming

edit:

if you just want to add the var to the file name

Zip.Add(_DesktopFolder.."\\date_result.."-mdbbackup.zip", {"AutoPlay\\Docs\\*.enc"}, true, "", 9, ZipCallBack, true);

el5ateer
03-24-2007, 01:43 PM
Thanks RizlaUK :D seems i got it wrong

Bruce
03-24-2007, 03:01 PM
if you just want to add the var to the file name

Zip.Add(_DesktopFolder.."\\date_result.."-mdbbackup.zip", {"AutoPlay\\Docs\\*.enc"}, true, "", 9, ZipCallBack, true);

BINGO!! Thank you sir! :yes

ERRR spoke to soon... I have an issue in here somewhere. The red quote jacks it up.

RizlaUK
03-24-2007, 03:17 PM
sorry bruce, try this way :yes

Zip.Add(_DesktopFolder.."\\"..date_result.."-mdbbackup.zip", {"AutoPlay\\Docs\\*.enc"}, true, "", 9, ZipCallBack, true);

Bruce
03-24-2007, 03:26 PM
hummm now it's not creating the zip. :huh I'll update ya.

RizlaUK
03-24-2007, 03:37 PM
ok try this

Escape = String.Replace(date_result, "/", "_", false);
Zip.Add(_DesktopFolder.."\\"..Escape.."-mdbbackup.zip", {"AutoPlay\\Docs\\*.enc"}, true, "", 9, ZipCallBack, true);

its because of the "/" in the date, it was creating the zip but in folders "03" "24" "2007"

Bruce
03-24-2007, 04:11 PM
Yes that did it. interesting... Thanks RizlaUK

Bruce
03-24-2007, 04:18 PM
This works too:
date_result = System.GetDate(DATE_FMT_US);
new_date_result = String.Replace(date_result, "/", "", false);

Zip.Add(_DesktopFolder.."\\"..new_date_result.."-mdbbackup.zip", {"AutoPlay\\Docs\\*.enc"}, true, "", 9, ZipCallBack, true);

I would have never caught that. Thanks

RizlaUK
03-24-2007, 04:19 PM
I would have never caught that. Thanks

No Problem Bruce......any time :yes

Dermot
03-25-2007, 01:42 PM
or just use date_result = System.GetDate(DATE_FMT_ISO); to avoid the issue altogether.

RizlaUK
03-25-2007, 08:50 PM
or just use date_result = System.GetDate(DATE_FMT_ISO); to avoid the issue altogether.

well it just goes to show, as much as iv learnt about apms, i still miss the simple things ;)