Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

extract tar file to different folder

  • 23-06-2009 03:00PM
    #1
    Registered Users, Registered Users 2 Posts: 169 ✭✭


    hi,
    im trying to get a tar file that was archived on a box with completely different folders structures to extract onto another box with different folders.

    how can i do this?
    can i get tar extract to ignore attempting to create folders, just extract to a specified folder?

    cheers
    db


Comments

  • Closed Accounts Posts: 12,807 ✭✭✭✭Orion


    you can use the '-no-recursion' switch to dump all the files into one directory - is that what you mean?


  • Registered Users, Registered Users 2 Posts: 1,346 ✭✭✭carveone


    hi,
    im trying to get a tar file that was archived on a box with completely different folders structures to extract onto another box with different folders.

    how can i do this?
    can i get tar extract to ignore attempting to create folders, just extract to a specified folder?

    cheers
    db

    Good question. If you mean like pkunzip used to (annoyingly) do by default, that is extract every file in the archive into one directory, I don't believe so. There's no option to do it, even in Gnu tar. You could, however, extract the files first and then write a script to flatten the result...


  • Registered Users, Registered Users 2 Posts: 1,346 ✭✭✭carveone


    Macros42 wrote: »
    you can use the '-no-recursion' switch to dump all the files into one directory - is that what you mean?

    Oh, I thought that switch was only valid with --create. Not in front of a unix machine now so I can't check...


  • Registered Users, Registered Users 2 Posts: 169 ✭✭DonnieBrasco


    Macros42 wrote: »
    you can use the '-no-recursion' switch to dump all the files into one directory - is that what you mean?

    yes - i think !

    3 files within the same directory were tar'd.

    This directory on the new server does not exist and now when trying to un-tar it produces errors because i dont have create directory privs to create the original directory structure.
    So i just want to un-tar to a single specified folder.

    As it happens... i've been able to untar from a windows workstation and just ftp'd the files individually to the folder. so i have now worked around it. im curious tho !

    cheers
    db


  • Closed Accounts Posts: 12,807 ✭✭✭✭Orion


    The man page says nothing about --norecursion being only valid with --create so I'm not sure. However from the sounds of things you could have used sudo or just extracted in your own home directory to get what you want.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 811 ✭✭✭Rambo


    hi,
    im trying to get a tar file that was archived on a box with completely different folders structures to extract onto another box with different folders.

    how can i do this?
    can i get tar extract to ignore attempting to create folders, just extract to a specified folder?

    cheers
    db

    have you tried using ark --extract-to

    http://manpages.ubuntu.com/manpages/gutsy/man1/ark.1.html


  • Registered Users, Registered Users 2 Posts: 432 ✭✭Catch_22


    just chroot the tar extract to some folder and then you can do what you like with the resulting files.


  • Registered Users, Registered Users 2 Posts: 3,721 ✭✭✭E39MSport


    Catch_22 wrote: »
    just chroot the tar extract to some folder and then you can do what you like with the resulting files.

    Nice !


Advertisement