Angel1403
Angel1403

Reputation: 145

Issues with Running Rsync Command

I am using rsync in my perl script.

I am using the following command:

rsync -av /view/pore/Personel Address.txt /home/myserver/Personel Address.txt

It fails giving me error as:

building file list .. rsync: link_stat "/view/pore/Personel Address.txt: failed: No such file or directory

If I rename the file to Personel_Address.txt, it works fine.

Can anyone please help me with the correct command to be used. I cannot rename the text file to Personel_Address.

Thanks!

Upvotes: 1

Views: 977

Answers (2)

t3nshi
t3nshi

Reputation: 21

the problem here is that you need to escape the space. something like

rsync -av /view/pore/Personel\ Address.txt /home/myserver/Personel\ Address.txt

instead of simply

rsync -av /view/pore/Personel Address.txt /home/myserver/Personel Address.txt

should work the way you want.

Upvotes: 2

spydon
spydon

Reputation: 11512

Add a backslash before the space like this:

rsync -av /view/pore/Personel\ Address.txt /home/myserver/Personel\ Address.txt

It's usually nicer not to have spaces in filenames though. If you have a space the program thinks that it is the next parameter that it takes, but with the \ it cancels it out and passes the whole string as one parameter.

Upvotes: 3

Related Questions