|
#1
|
|||
|
|||
|
I have read other posts regarding this, but I haven't been able to find a way around this problem. I want to use Zip.Extract to extract and recreate the subfolders just as they were in the folder that they were backed up from (i.e. for potential rollback after an upgrade). I am using the following code to zip up the files noted below it:
ZipBackupFile = "C:\\ZipFolderTest"; BackupFolder = "C:\\topfolder"; tblFilesToBackup = {}; tblFilesToBackup = File.Find(BackupFolder,"*.*",true,true,nil); Zip.Add(ZipBackupFile,tblFilesToBackup,true,"",tru e,0,nil,true); then later: Zip.Extract("C:\\ZipFolderTest.zip",{"*.*"},"C:\\e xtractfolder",true,true,"",ZIP_OVERWRITE_ALWAYS,ni l); files to be zipped: c:\topfolder\subfolder1\test1.txt c:\topfolder\subfolder1\test2.txt c:\topfolder\subfolder2\test3.txt c:\topfolder\subfolder2\test4.txt desired extraction structure: c:\extractfolder\subfolder1\test1.txt c:\extractfolder\subfolder1\test2.txt c:\extractfolder\subfolder2\test3.txt c:\extractfolder\subfolder2\test4.txt What I actually get with Zip.Extract (depending on how "include folders" and "recurse" are set) is either: c:\extractfolder\test1.txt c:\extractfolder\test2.txt c:\extractfolder\test3.txt c:\extractfolder\test4.txt - or - the above plus the two empy folders, subfolder1 and subfolder2. I can't seem to extract the files ~into~ the subfolders. Help! Thanks in advance for any suggestions. |
|
#2
|
||||
|
||||
|
Here is an example to compress a folder:
Code:
-- define source folder to compress
FolderName = Dialog.FolderBrowse("Select the folder to compress", _TempFolder)
-- define destination archive
ZipBackupFile = _TempFolder .. "\\IR_ZipActions.zip";
-- include everything in the source folder
tblFilesToBackup = { FolderName .. "\\*.*"}
-- perform the file compression (without callback, so wait for confirmation/error dialog)
Zip.Add(ZipBackupFile, tblFilesToBackup, true, "", 5, 0, true);
error = Application.GetLastError();
if (error ~= 0) then
Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
else
Dialog.Message("Success", "Folder " .. FolderName .. " was successfully compressed to " .. _TempFolder .. "\\IR_ZipActions.zip\r\n" .."Please examine the file (with WinZip or something else) before proceeding." , MB_OK, MB_ICONINFORMATION);
end
Code:
-- try to uncompress the file IR_ZipActions.zip in your temporary folder
if (File.Find(_TempFolder, "IR_ZipActions.zip") == nil) then
Dialog.Message("Error", "The expected zip file was not found.\r\nDid you compress any folder first?", MB_OK, MB_ICONEXCLAMATION);
else
-- perform the uncompression (again withou callback, so wait for outcome)
Zip.Extract(_TempFolder .. "\\IR_ZipActions.zip", {"*.*"}, _TempFolder .. "\\Extractfolder", true, true, "", ZIP_OVERWRITE_ALWAYS);
error = Application.GetLastError();
if (error ~= 0) then
Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
else
Dialog.Message("Success", "The files contained in " .. _TempFolder .. "\\IR_ZipActions.zip were recursively extracted to " .. _TempFolder .. "\\ExtractFolder\\\r\nCheck the folder contents now.", MB_OK, MB_ICONINFORMATION);
end
end
Last edited by Ulrich; 03-06-2009 at 07:13 AM. |
|
#3
|
|||
|
|||
|
Thanks!
Thanks so much, Ulrich. In the end they decided to go with another backup method, but I will save this code for future reference, as I know it will come up again
|
|
#4
|
||||
|
||||
|
Are Zip.Add and Zip.Extract part of Setup factory?? I am using SF7 version.
I am getting errors saying : Quote:
Can anyone comment on this with any useful information to zip and extract files from SF, or if I have any command line commands for windows to zip files? |
|
#5
|
||||
|
||||
|
Quote:
Ulrich |
|
#6
|
||||
|
||||
|
Its Working, Thanks
My Zip plugin was unchecked as you said ThankYou! |
|
#7
|
||||
|
||||
|
Please provide the help avaialble for Zip.Add() from the help files
This is all okay, but I still do not have the Zip.Add or related stuff in the HelpFiles. Can someone post the syntax and its support details from their respective help files if they have it. I am trying to get a Progress bar while zipping my contents for backup and I dont have the help file for the Zip.Add to refer. The samples might work, but I want to know in and out of the command before I use it in my setups.
Please paste it here, or guide me where I can get it, or why I do not have it in the referring manuals? ThankYou! |
|
#8
|
||||
|
||||
|
Quote:
plugins are extensions to the product, and their help files are separate from the product's own docs, provided by the writer of the plugin - not necessarily Indigo Rose. For most available plugins, you can see the shipped help file this way: In the menu, go to Resources > Plugins, select the plugin, click About Plugin, then click Plugin Help. This should open the documentation, which can be a HTML file, PDF doc, etc. Ulrich |
|
#9
|
||||
|
||||
|
Thats exactly what I needed
|
![]() |
| Tags |
| zip.extract |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Changing resource folder structure | dnandor | AutoPlay Media Studio 6.0 | 2 | 07-20-2007 11:42 AM |
| IF else statement | synistics | AutoPlay Media Studio 6.0 | 3 | 04-21-2007 01:33 PM |
| cookies | goukilord10 | AutoPlay Media Studio 5.0 | 6 | 05-20-2005 05:08 PM |
| INFO: The Explore Button on the Distribution Folder Dialog | Support | AutoPlay Media Studio 4.0 Examples | 0 | 10-11-2002 01:06 PM |
All times are GMT -6. The time now is 04:49 AM.










Linear Mode

