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
You can use
put for that as well (at least in 1.0.0):
local_pathmay be a relative or absolute local file or directory path, and may contain shell-style wildcards, as understood by the Python glob module. Tilde expansion (as implemented by os.path.expanduser) is also performed.
Update: This example works fine (for me) on 1.0.0.:
from fabric.api import env from fabric.operations import run, put env.hosts = ['firstname.lastname@example.org'] def copy(): # make sure the directory is there! run('mkdir -p /home/frodo/tmp') # our local 'testdirectory' - it may contain files or subdirectories ... put('testdirectory', '/home/frodo/tmp') # [email@example.com] Executing task 'copy' # [firstname.lastname@example.org] run: mkdir -p /home/frodo/tmp # [email@example.com] put: testdirectory/HELLO -> \ # /home/frodo/tmp/testdirectory/HELLO # [firstname.lastname@example.org] put: testdirectory/WORLD -> \ # /home/frodo/tmp/testdirectory/WORLD # ...