栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何使用Fabric将目录复制到远程计算机?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何使用Fabric将目录复制到远程计算机?

您也可以使用

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# ...


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/638342.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号