erazer
Junior Member
Posts: 61
|
Post by erazer on Feb 22, 2009 18:35:21 GMT -5
Well.. Now for example I want to extract from container folder "Favorites" all files and folders to folder MyFavorites ZipName := edtRestFilename.Text; // set the zip filename FilesList.Add('Favorites\*'); DestDir := 'c:\temp\1\MyFavorites'; RecreateDirs := True; Unzip;
So I get C:\TEMP\1\MyFavorites\Favorites\ I need to exclude "Favorites\" Is there any way, except as during zipping ?
|
|
|
Post by Kevin on Feb 22, 2009 22:05:25 GMT -5
ZipName := edtRestFilename.Text; // set the zip filename FilesList.Add('Favorites\*'); RootDir := 'Favorites'; <-- Add this to strip Favorites DestDir := 'c:\temp\1\MyFavorites'; RecreateDirs := True; Unzip;
Take a look at RootDir in the help file for a complete explanation.
|
|
erazer
Junior Member
Posts: 61
|
Post by erazer on Feb 23, 2009 2:24:53 GMT -5
Of course I tryed that, but if I use Favorites, I get nothing, that's why I have to ask you
|
|
|
Post by Kevin on Feb 23, 2009 7:25:08 GMT -5
I'm not sure what you mean by "you get nothing".
Yes, if the file in the archive is 'Favorites\somefile.txt', then when Favorites is stripped, you get somefile.txt. When 'somefile.txt' is added to DestDir it becomes 'c:\temp\1\MyFavorites\somfile.txt' which is what you wanted isn't it?
And if what is in the archive is 'Favorites\Links\somefile.txt' then when 'Favorites' gets removed you get 'Links\somefile.txt'. This added to the DestDir gives you 'c:\temp\1\MyFavorites\Links\somefile.txt'.
|
|
erazer
Junior Member
Posts: 61
|
Post by erazer on Feb 23, 2009 8:05:39 GMT -5
So SHOULD BE, but in practice nothing unzipped. And I'm too cant understand WHY?
|
|
|
Post by Kevin on Feb 23, 2009 8:42:04 GMT -5
OK, let me be sure I understand. When you do NOT set RootDir you DO get files unzipped but when you DO set RootDir nothing is unzipped. Is that correct?
Also, I don't remember if you have said... What version of VCLZip are you using and what version of Delphi are you using?
|
|
erazer
Junior Member
Posts: 61
|
Post by erazer on Feb 23, 2009 9:38:00 GMT -5
SORRY!SORRY!SORRY!SORRY!SORRY!SORRY!SORRY!SORRY!SORRY!SORRY! I'm IDIOT ;D
|
|
|
Post by Kevin on Feb 23, 2009 9:39:44 GMT -5
HUH? Does that mean it is working?
|
|
erazer
Junior Member
Posts: 61
|
Post by erazer on Feb 23, 2009 9:42:55 GMT -5
RootDir := 'Favorites'; It seems to me I forgot about this. I'll test it some hours later
|
|
|
Post by Kevin on Feb 23, 2009 9:54:40 GMT -5
OK. ;D BTW, I just finished testing it to be sure there was no bug and it worked great (I tested version 4.50) So let me know how it goes.
|
|
erazer
Junior Member
Posts: 61
|
Post by erazer on Feb 27, 2009 3:48:43 GMT -5
Everything works fine, as should, now I have another problem : flickering of Gauge diring unpacking. I have to unpack 3 folders, but bkz I pack them as one folder I decided to use only one gauge to show common progress, so when I unzip them progress changes 3 times, twice it happens very fast, but 3-d time too long. so how do you abvice to be in this case ? could I show common progress of unpackink of the three folders ?
|
|
|
Post by Kevin on Feb 27, 2009 10:25:22 GMT -5
You should probably create your own progress meter. Set it according to the number of files in the archive... VCLZip.Count. Then put a line of code in the OnEndUnZip event that updates it as each file is finished unzipping.
|
|
erazer
Junior Member
Posts: 61
|
Post by erazer on Feb 28, 2009 17:46:54 GMT -5
Well, but how should I get it ? with Zipper do begin ZipName := RestoreFilename; // set the zip filename Count; Showmessage(inttostr(count)); end; Show me '0'.
|
|
erazer
Junior Member
Posts: 61
|
Post by erazer on Feb 28, 2009 17:54:16 GMT -5
with Zipper do begin ZipName := RestoreFilename; // set the zip filename Unzip; Count; Showmessage(inttostr(count)); end; Of course returns 119 for example, but I dio not need unzip, I just want to get count... More, I do not unzip ALL files, some times I have to unzip 20-50 files from different folders (favorites&contacts) for example, so I need to count how many files in them before unzipping. I cant imagine how have I do this
|
|
|
Post by Kevin on Feb 28, 2009 20:58:48 GMT -5
If you are not unzipping all files and you don't know how many you will be unzipping then the OnStartUnZipInfo event will have the information you want. It is called before any unzipping starts and one of it's parameters is NumFiles which is the number of files that will be unzipped. So you can set up your progress meter in this event.
procedure TVCLUnZip.OnStartUnZipInfo(Sender: TObject; NumFiles: Integer; TotalBytes: Comp; var StopNow: Boolean);
|
|