您也可以使用
put它(至少在1.0.0中使用):
local_path可以是相对或绝对本地文件或 目录路径 ,并且可以包含 shell样式的通配符 ,如Python glob
模块所理解的那样。波形扩展(由os.path.expanduser实现)也将执行。
请参阅:http
:
//docs.fabfile.org/en/1.0.0/api/core/operations.html#fabric.operations.put
更新:此示例对1.0.0很好(对我而言):
from fabric.api import envfrom fabric.operations import run, putenv.hosts = ['frodo@middleearth.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')# [frodo@middleearth.com] Executing task 'copy'# [frodo@middleearth.com] run: mkdir -p /home/frodo/tmp# [frodo@middleearth.com] put: testdirectory/HELLO -> # /home/frodo/tmp/testdirectory/HELLO# [frodo@middleearth.com] put: testdirectory/WORLD -> # /home/frodo/tmp/testdirectory/WORLD# ...


