Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Rsync from Python [duplicate]

Tags:

python

curl

rsync

I need to run an rsync command from Python. Is this possible and if so, how do I do it?

rsync -Ccavz --delete DJStatic username@website
like image 569
Marcus Avatar asked Aug 21 '13 23:08

Marcus


1 Answers

You can call a subprocess from python using the following snippet

import subprocess
subprocess.call(["ls", "-l"])

In your case, it would be something like this

subprocess.call(["rsync", "-Ccavz", "--delete","DJStatic", "username@website"])

See here for more details.

like image 115
philshem Avatar answered Nov 01 '22 13:11

philshem