Find the answer to your Linux question:
Results 1 to 7 of 7
i'm trying to compress a folder with tar but tar claims the folder is empty. it isn't empty there is just another folder in it and in there the files ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2002
    Location
    southern ontario, canada
    Posts
    37

    tar problems


    i'm trying to compress a folder with tar but tar claims the folder is empty.
    it isn't empty there is just another folder in it and in there the files are.
    should i just stick a useless file in the base folder.

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    That works perfectly for me. What tar options are you using?

  3. #3
    Linux User
    Join Date
    Jul 2002
    Location
    Daytona Beach, FL
    Posts
    487
    works fine for me - remember as far as tar is concerned folders are just special files...


    [majorwoo@woo majorwoo]$ mkdir test
    [majorwoo@woo majorwoo]$ mkdir test/test
    [majorwoo@woo majorwoo]$ mkdir test/test/test
    [majorwoo@woo majorwoo]$ touch test/test/test/blah1
    [majorwoo@woo majorwoo]$ touch test/test/test/blah2
    [majorwoo@woo majorwoo]$ touch test/test/test/blah3
    [majorwoo@woo majorwoo]$ tar czvf test.tar.gz test/
    test/
    test/test/
    test/test/test/
    test/test/test/blah1
    test/test/test/blah2
    test/test/test/blah3
    [majorwoo@woo majorwoo]$
    majorwoo

    Quiet brain, or I\'ll stab you with a Q-tip.

  4. #4
    Just Joined!
    Join Date
    Oct 2002
    Location
    southern ontario, canada
    Posts
    37
    so did i (just now) but it won't list them now.
    $>tar -t basemod
    and it just freezes. nothing gets displayed about the file. i used ctrl-c to get out of it. the file command claims it is a tar file.

  5. #5
    Just Joined!
    Join Date
    Oct 2002
    Location
    southern ontario, canada
    Posts
    37
    also for me it didn't display the files that it was compressing.

  6. #6
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Yep, that's right (about the freezing when you list, that is). If you do not specify the -f option to tar, it tries to read from stdin, i.e. your terminal input. You should do either 'tar -tf basemod' or 'tar -t <basemod'.
    And when compressing, it doesn't list the files it compresses without the -v option (v as in verbose).
    Also, when we're at it: it won't compress the archive without the -z option. tar in itself only produces raw archives, so if you want to compress it, either specify the -z option to make tar filter the output through gzip, or run gzip yourself, either by gzipping the complete tar file manually afterwards or by piping tar's output into gzip.
    You might find tar(1) and gzip(1) useful.

  7. #7
    Linux User
    Join Date
    Jul 2002
    Location
    Daytona Beach, FL
    Posts
    487
    yeah I spose I should have left the z off and added it afterwords - force of habit
    majorwoo

    Quiet brain, or I\'ll stab you with a Q-tip.

Posting Permissions

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