Forum > Linux

zip and unzip archives

(1/2) > >>

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/ /tmp/myapp/' it zips but it contains only the folder tmp -> myapp. When I execute this : 'zip -r /home/myname/desktop/ /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 ?


try to use:

Installation was easy and without any problems.
When I make a zipfile using this code:

--- Code: ---var dir : String;
    ZipFile : TZipFile;
        dir := GetTempDir + 'working';
        Img.Picture.PNG.SaveToFile(dir + '/img1.png');
        Img1.Picture.PNG.SaveToFile(dir + '/img2.png');
        ZipFile.FileName := strFile;
        ZipFile.AppendFileFromDisk(dir + '/img1.png', ZipFile.FileName);
        ZipFile.AppendFileFromDisk(dir + '/img2.png', ZipFile.FileName);
        ZipFile.Active := false;
           // ...
--- End code ---
I get an error when I wan to open this zipfile with the Archivemanager.

--- Quote ---Archive:  /home/myname/Desktop/
  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/ or
          /home/myname/Desktop/, and cannot find /home/myname/Desktop/, period.

--- End quote ---

zip /home/myname/desktop/ /tmp/myapp/*

thanks  ;D


[0] Message Index

[#] Next page

Go to full version