Forum > Linux
zip and unzip archives
Mangafreak1995:
Hey lazarus-guys,
I'm using a TProcess to execute the 'zip' and 'unzip' command. But it doesn't work fine. Unzipping works very well, but when I execute sth like this : 'zip /home/myname/desktop/file.zip /tmp/myapp/' it zips but it contains only the folder tmp -> myapp. When I execute this : 'zip -r /home/myname/desktop/file.zip /tmp/myapp/' it zips everything in the /tmp/myapp/ folder but in the archive there are also those two subdirectories again. I want the files from the folder /tmp/myapp/ in the archive without subdirectories (but the subdirs of /tmp/myapp/). What am I doing wrong or what param makes this working ?
Mangafreak1995
fabienwang:
try to use: http://wiki.lazarus.freepascal.org/ZipFile
Mangafreak1995:
Installation was easy and without any problems.
When I make a zipfile using this code:
--- Code: ---var dir : String;
ZipFile : TZipFile;
begin
try
dir := GetTempDir + 'working';
ForceDirectories(dir);
Img.Picture.PNG.SaveToFile(dir + '/img1.png');
Img1.Picture.PNG.SaveToFile(dir + '/img2.png');
ZipFile.FileName := strFile;
ZipFile.Activate();
ZipFile.AppendFileFromDisk(dir + '/img1.png', ZipFile.FileName);
ZipFile.AppendFileFromDisk(dir + '/img2.png', ZipFile.FileName);
ZipFile.Active := false;
except
// ...
--- End code ---
I get an error when I wan to open this zipfile with the Archivemanager.
--- Quote ---Archive: /home/myname/Desktop/myarchive.zip
[/home/myname/Desktop/myarchive.zip]
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
zipinfo: cannot find zipfile directory in one of /home/myname/Desktop/myarchive.zip or
/home/myname/Desktop/myarchive.zip, and cannot find /home/myname/Desktop/myarchive.zip, period.
--- End quote ---
Ocye:
zip /home/myname/desktop/file.zip /tmp/myapp/*
Mangafreak1995:
thanks ;D
Navigation
[0] Message Index
[#] Next page