LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-09-2007, 05:18 AM   #1
activeq
Member
 
Registered: Jul 2006
Location: Balen, Belgium
Distribution: Suse 10, Centos, Open Solaris
Posts: 76

Rep: Reputation: 15
Restore with tar


Hi,

It is possible to restore a folder with all it contents with tar?

i've made a test:

/home/test1/test2/test2/test.txt

I want to restore from folder test2 and its content, but tar don't let me do this.

command:
tar -xvf test.tar test2

tar reply: tar: test2: Not found in archive.

when I do tar -tvf test.tar i see test2 is in the archive.

Do i mis something?
 
Old 01-09-2007, 06:04 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
I think that you have to add parent directories. This depends on how you created it. But I'm not sure.
Code:
tar -xvf test.tar /home/test1/test2
I can however understand that tar does not like what you try to do as you have two directories called test2; how is tar supposed to know which one to extract?
 
Old 01-09-2007, 06:39 AM   #3
activeq
Member
 
Registered: Jul 2006
Location: Balen, Belgium
Distribution: Suse 10, Centos, Open Solaris
Posts: 76

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Wim Sturkenboom
I think that you have to add parent directories. This depends on how you created it. But I'm not sure.
Code:
tar -xvf test.tar /home/test1/test2
I can however understand that tar does not like what you try to do as you have two directories called test2; how is tar supposed to know which one to extract?

You're right. I already figured it out.

I have it quiet often spending many hours to solve a problem, post a question on a forum and then suddenly I got it.

Anyway...you confirmed my solution.

Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
restore a tar file. David@330 Linux - Newbie 1 06-01-2006 09:26 AM
tar/restore questions solex Linux - General 5 09-01-2004 02:03 PM
backup and restore using tar AZDAVE Linux - General 6 11-28-2003 08:40 PM
how can I restore a tar backup len snelly Linux - Newbie 1 04-30-2002 12:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration