我有这个python脚本,它可以执行,但是“参数”部分被排除在外。结果,“path”中的所有文件都被下载到“target”。理想情况下,它还应该包含“参数”部分,其中包含排除和包含过滤器。你知道吗
如何允许此脚本的“参数”部分执行?你知道吗
我也愿意在boto3等方面采取变通办法
Import awscli
Import os
Import time
path = 's3://source/treasure/'
target = 'C:\\Home\\Day\\'
parameter = ' --recursive --exclude "*" --include "status.2018-'
monthlog = time.strftime("%m-%d")
execute='aws s3 cp '+path+' '+target+''+parameter+''+monthlog+'.log"'
subprocess.run(['cmd','/c',execute])
参考文献: https://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters
您可以使用
shell=True
或将参数分解为一个列表:注意,如果不使用
shell=True
,则不需要在*
周围加引号,因为引号仅用于抑制shell扩展;如果不使用shell,则不需要抑制它,可以直接按通配符。你知道吗相关问题 更多 >
编程相关推荐