from fabric.api import env
from fabric.operations import run, put
env.hosts = ['frodo@middleearth.com']

def copy():
    run('mkdir -p /home/frodo/tmp')
put('testdirectory', '/home/frodo/tmp')
How do I copy a directory to a remote machine using Fabric?