Find the answer to your Linux question:
Results 1 to 4 of 4
I have a file: daily_SVG_snapshot.tar.bz2 It contains 8025 files in 630 directories. I want to extract all 8025 files into one directory. What is the command line for this? --OR-- ...
  1. #1
    Just Joined!
    Join Date
    Apr 2008
    Posts
    1

    Extracting .tar.bz2 file WITHOUT Contained Directories

    I have a file: daily_SVG_snapshot.tar.bz2

    It contains 8025 files in 630 directories.

    I want to extract all 8025 files into one directory.

    What is the command line for this?

    --OR--

    I want to copy/move 8025 files from 630 directories into one directory, using only a short command line command. "cp -v ./*/*.svg .", and "cp -r *.svg ." did not work, and I am not too hot on making a shell script to handle 630 directories individually.

    Thanks for any help.

  2. #2
    Just Joined!
    Join Date
    Nov 2007
    Posts
    9
    tar xvjf filename.tar.bz2

  3. #3
    Linux Engineer
    Join Date
    Nov 2004
    Location
    Ft. Polk, LA
    Posts
    796
    Tar doesn't have an option that I saw to do this. You'll probably need to make up a script to handle it.

  4. #4
    Just Joined!
    Join Date
    Aug 2008
    Posts
    3

    Solution is....

    [root@sjdevcon01 webex]# mkdir /tmp/vijay
    [root@sjdevcon01 webex]# cp -f `find . -name "*.jar" -type f` /tmp/vijay/
    [root@sjdevcon01 webex]# ll /tmp/vijay/
    total 84
    -rw-r--r-- 1 root root 79780 Sep 30 21:38 wapicom-2.1.jar
    [root@sjdevcon01 webex]# cp -f `find . -type f` /tmp/vijay/
    cp: overwrite `/tmp/vijay/wapicom-2.1.jar'? y
    [root@sjdevcon01 webex]# ll /tmp/vijay/
    total 120
    -rw-r--r-- 1 root root 284 Sep 30 21:38 maven-metadata.xml
    -rw-r--r-- 1 root root 32 Sep 30 21:38 maven-metadata.xml.md5
    -rw-r--r-- 1 root root 40 Sep 30 21:38 maven-metadata.xml.sha1
    -rw-r--r-- 1 root root 79780 Sep 30 21:38 wapicom-2.1.jar
    -rw-r--r-- 1 root root 32 Sep 30 21:38 wapicom-2.1.jar.md5
    -rw-r--r-- 1 root root 40 Sep 30 21:38 wapicom-2.1.jar.sha1
    -rw-r--r-- 1 root root 4526 Sep 30 21:38 wapicom-2.1.pom
    -rw-r--r-- 1 root root 32 Sep 30 21:38 wapicom-2.1.pom.md5
    -rw-r--r-- 1 root root 40 Sep 30 21:38 wapicom-2.1.pom.sha1
    [root@sjdevcon01 webex]#

Posting Permissions

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