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 = ['email@example.com'] 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') # [firstname.lastname@example.org] Executing task 'copy' # [email@example.com] run: mkdir -p /home/frodo/tmp # [firstname.lastname@example.org] put: testdirectory/HELLO -> \ # /home/frodo/tmp/testdirectory/HELLO # [email@example.com] put: testdirectory/WORLD -> \ # /home/frodo/tmp/testdirectory/WORLD # ...