Page 1 of 1

How to make an identical copy of dirs with spaces?

Posted: 21 Mar 2010, 04:51
by Moloko
Hi,

I have a BubbaTwo and another server. The idea here is to copy over all the home directories from BubbaTwo's, where lots of them consists of spaces in the directory name, onto the other server.

I want to make an exact copy of the files, preserve all the file attributes and so on...


Can somebody please give me tips or solution on how to achieve this??

Re: How to make an identical copy of dirs with spaces?

Posted: 21 Mar 2010, 05:00
by Eek
Hi

use tar
go to the directory from which you wish to copy everything.
tar cvfz /tmp/something.tgz .
everything is now archived and compressed
copy the file over and unpack with
tar xvfz /tmp/something.tgz

Re: How to make an identical copy of dirs with spaces?

Posted: 22 Mar 2010, 07:30
by Kiff
I think rsync is the usual way to go, but I have never set it up myself. http://everythinglinux.org/rsync/

Re: How to make an identical copy of dirs with spaces?

Posted: 24 Mar 2010, 09:18
by Moloko
Thanks for the answers!

I think I'll try to go with rsync, as I don't have much free space on my BubbaTwo...

Re: How to make an identical copy of dirs with spaces?

Posted: 25 Mar 2010, 18:11
by 6feet5
If this is only a one time shot then Rsync sounds like a waste of time.

I dont know what OS you're using on the receiving end, but a shared folder (samba or nfs) on the receiving end will do. Tar the file to the shared folder according to Eeks instructions. This will not waste any space.

If shared folders are far too lame for you, and you want to be a bit more geek, use netcat.
Make sure you have netcat installed on both units (your bubba and receiving server, windows versions are available)
First, on your server, type:

Code: Select all

nc -l -p 9999|tar xz
Second, on your bubba, type:

Code: Select all

tar cz <folder>|nc -w 1 <host> 9999
where <folder> is the folder you want to copy, and <host> is the host name (or IP) of your server.
And that's all there is to it, your folder has been piped over the network to the server, without wasting any space.

/Johan

PS If there is one network tool you should know about, it's netcat (aka 'nc'). It can save your day, trust me.

Re: How to make an identical copy of dirs with spaces?

Posted: 31 Mar 2010, 16:02
by Moloko
6feet5, thx for the tip - it's working great!

OS: Debian on both Bubba and the other server