Find the answer to your Linux question:
Results 1 to 7 of 7
Hello I want to know how can I use the zip or tar command to compress a directory (recursively) and limit the filesize of the archive. Also, I want to ...
  1. #1
    Just Joined!
    Join Date
    May 2008
    Posts
    34

    zip usage question

    Hello
    I want to know how can I use the zip or tar command to compress a directory (recursively) and limit the filesize of the archive. Also, I want to write the contents of the zip or tar file (dirs and files) to a .txt file so that I know what's where according to the tar filename and txt file name.

  2. #2
    Just Joined! clickalot's Avatar
    Join Date
    Nov 2009
    Location
    Erlangen, Germany
    Posts
    37
    i use the archiver and compression tool 7-zip.

    in the command line you can "zip" a directory with:
    Code:
    $ 7z a directory
    and it integrates well in the file manager nautilus, if you use it, that is.

    and you can know the contents of the directory.7z archive with:
    Code:
    $ 7z l directory.7z > contents.txt
    Last edited by clickalot; 11-11-2009 at 09:51 PM. Reason: mistake

  3. #3
    Just Joined!
    Join Date
    May 2008
    Posts
    34
    Ok I only have ssh access to this server. I installed the 7zip rpm package..how do i call it ?
    Code:
    root@spyder ~]# 7z l directory > contents.txt
    -bash: 7z: command not found

  4. #4
    Just Joined! clickalot's Avatar
    Join Date
    Nov 2009
    Location
    Erlangen, Germany
    Posts
    37
    i don't know any details of your operating system or what you want to do...
    you said 7-zip is installed. can you run this:

    Code:
    $ whereis 7z

  5. #5
    Just Joined!
    Join Date
    May 2008
    Posts
    34
    Code:
    -bash: 7z: command not found
    [root@spyder ~]# whereis 7z
    7z:
    [root@spyder ~]# whereis p7zip
    p7zip: /usr/bin/p7zip /usr/libexec/p7zip /usr/share/p7zip
    [root@spyder ~]#

  6. #6
    Just Joined! clickalot's Avatar
    Join Date
    Nov 2009
    Location
    Erlangen, Germany
    Posts
    37
    it looks like you have a different port of 7-zip ...

    anyway what i told you for 7z should work the same with p7zip (with the same options except you substitute 7z with p7zip...)
    Don't be shy and try:
    Code:
    $ man p7zip
    You should also try a more conventional approach in the *nix world:
    (actually maybe this is what you were looking for in the first place

    tar and gzip a directory :
    Code:
    $ tar -cvzf directory.tar.gz directory/
    list contents of a tarball (gzip'ed tar archive) :
    Code:
    $ tar -tzf archive.tar.gz
    extract the tarball :
    Code:
    $ tar -xvzf archive.tar.gz

  7. #7
    Just Joined!
    Join Date
    May 2008
    Posts
    34
    Code:
    [root@spyder ss]# man p7zip
    No manual entry for p7zip
    But its ok your help solved the problem, thanks
    tar command got the job done.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...