I have a directory on my local machine that I would like to copy to a remote machine (and rename it) using Fabric. I know I can copy file using put(), but what
For those using Fabric 2, put can no longer upload directories, only files. Also, rsync_project is no longer part of the main Fabric package. The contrib package has been removed, as explained here. Now, rsync_project has been renamed to rsync, and you need to install another package in order to be able to use it:
pip install patchwork
Now, assuming you already have created a connection to your server:
cxn = fabric.Connection('username@server:22')
You can use rsync as below:
import patchwork.transfers
patchwork.transfers.rsync(cxn, '/my/local/dir', target, exclude='.git')
Please refer to the fabric-patchwork documentation for more information.