Jump to content

[RESOLVED] Preventing tar from preserving full file paths


roopurt18

Recommended Posts

I'm trying to tar a directory on one machine to move it to another.

On the starting machine the directory is something like:
/dir1/dir2/dir3/dir4/user/domain/data/[i]the_dir[/i]

The target destination on the new machine is
/home/user/public_html/data/[i]the_dir[/i]

Try as I might, I keep getting a result like this on the target machine:
/home/user/public_html/data/dir1/dir2/dir3/dir4/user/domain/data/[i]the_dir[/i]

I'll keep reading documentation until I get it, but if anyone wants to help me along with this I'd greatly appreciate it!
Link to comment
Share on other sites

Nevermind, I got it.

On the source machine, I was using a command like so:
tar -cf ~/host_move/the_dir.tar ~/domain/data/the_dir

Changing the command to:
tar --directory=/dir1/dir2/dir3/dir4/user/domain/data/ -cf ~/host_move/the_dir.tar the_dir

solved the problem.

I post this for anyone that runs into a similar situation.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.