LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-13-2016, 08:29 AM   #1
giobaxx
LQ Newbie
 
Registered: Jul 2013
Posts: 20

Rep: Reputation: Disabled
backup/restore HomeFolder/DataFolder with Tar without full path


Hello guys, first sorry for my basic english. I had to started to work with linux, even if for the moment a i make basics things i would like to do it in the better way as possible

Sometimes i have to move data between Ubuntu Workstation, mainly data from home profile but not only

if i want to backup the home folder of a standard user joe using my administrative accounts admin
i run the following command:

I want to save only the data preserving the permission(not temp files, configuration files, cache files, hidden files )

Can you tell me if the command below is a good choice?

Code:
tar -cpvzf /mnt/mybackup_Folder/back_joe.tar.gz /home/joe --exclude='.*'

When i restore the tar it recreate all the full path. So for example if i restore the tar inside /home/joe/Document/Restored_Files i will found

/
Code:
home/joe/Documents/Restored_Files/home/joe/Documents
/home/joe/Documents/Restored_Files/home/joe/Desktop
/home/joe/Documents/Restored_Files/home/joe/Download
etc

I would like to restore without full path as below:

Code:
/home/joe/Documents/Restored_Files/Documents
/home/joe/Documents/Restored_Files/Desktop
/home/joe/Documents/Restored_Files/Download
I tried with the option -C but maybe i didnt undestand as it works...

can you help me?
 
Old 11-13-2016, 01:00 PM   #2
rigor
Member
 
Registered: Sep 2011
Posts: 282

Rep: Reputation: Disabled
giobaxx,

If you just want to avoid having the home directory in the path, you can manually cd into the home directory, before running tar; then instead of using for example /home/joe in the tar command, use the "period" character, like this:

Code:
cd /home/joe
tar -cpvzf /mnt/mybackup_Folder/back_joe.tar.gz  .  --exclude='.*
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
tar the last periodic backup that is in another path and move the tar to some dir nelovicov Linux - Newbie 6 01-20-2012 09:40 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
Backup and Restore with TAR jay2809 Linux - Newbie 7 08-25-2004 04:47 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 - Newbie

All times are GMT -5. The time now is 02:43 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration