yoyodyne
yoyodyne

Reputation: 55

Error using rsync with variable concatenation in Python

I'm running the below script from the command line with this:

os.system("rsync -avrz -e \'ssh -i /root/.ssh/keyfile.pem\' /var/www/" + folder_name + " [email protected]:" + destfoldertosync)

and I get this when I print out the rsync:

rsync -avrz -e 'ssh -i /root/.ssh/keyfile.pem' /var/www/folder_name, [email protected]:/var/www/destfoldertosync

"/var/www/folder_name," is breaking rsync. It works fine with the folder name hardcoded in there. Why is it inserting a comma after the path and how can I stop it from doing that?

Note: I can't use paramiko so I want this to work with os.system.

Upvotes: 1

Views: 259

Answers (1)

yoyodyne
yoyodyne

Reputation: 55

I made the mistake of separating the parameters by commas on the cli. Now it works.

Upvotes: 1

Related Questions