LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   rsync bunch of files with space (https://www.linuxquestions.org/questions/linux-server-73/rsync-bunch-of-files-with-space-4175423513/)

swagcute 08-22-2012 07:52 PM

rsync bunch of files with space
 
I need to copy a bunch of files from one server to the other where most of the files and folders contain spaces. Basically I'm moving bunch of directories created by windows clients in samba file server to the new samba server. So i don't need to preserve the permissions or owners of previous samba user. I used the following command and more combinations but none of them seems to be copying files and folders with spaces.
sudo rsync -rv root@192.168.1.2:/home/users/abcd /data/home/abc

chrism01 08-22-2012 08:07 PM

If this is a one-off copy (as it sounds) then rsync is overkill; its main claim to fame/efficiency is only copying file changes.; in this case that's 100% anyway.
I'd just use
Code:

# on target box
cd /data/home/abc
scp -r root@192.168.1.2:/home/users/abcd/* .

#reverse args if starting from src box


swagcute 08-22-2012 08:36 PM

Thanks for the reply. Now I've used scp and still the files and folders with space not copied. Please help me out.

szboardstretcher 08-22-2012 08:51 PM

well,.. rsync should pick up the spaces fine.

Code:

rsync -varh --progress /from/dir/ /to/dir/

swagcute 08-23-2012 06:24 PM

Thanks for the command. I have already tried similar. It copy the files with blank space but permission is denied as it keep the original ownership from previous fileserver. But then I issued chmod -R and chown -R to solve the problem.

chrism01 08-23-2012 07:30 PM

Hmmm just tested this (ip obscured)
Code:

scp * user@1.2.3.4:/tmp
with a file with a space in name; worked fine.

Reuti 08-24-2012 09:57 AM

I see it also working with scp. Can you provide any error information? You can also use tar:
Code:

$ ssh root@1.2.3.4 tar cz -C /home/users abcd | tar xz -C /data/home/abc


All times are GMT -5. The time now is 06:33 AM.