使用Azure CLI、Rest API或Python在Azure ADLS gen2中复制文件
是否有任何简单的方法可以使用Azure CLI、Rest API或Python在Azure ADLS gen2中复制数据 Azure ADLS gen2 API文档目前非常有限。。。使用Azure CLI、Rest API或Python在Azure ADLS gen2中复制文件,python,azure,azure-data-lake-gen2,Python,Azure,Azure Data Lake Gen2,是否有任何简单的方法可以使用Azure CLI、Rest API或Python在Azure ADLS gen2中复制数据 Azure ADLS gen2 API文档目前非常有限。。。 根据我的研究,我们可以使用Azure CLI或python来移动目录或文件。有关更多详细信息,请参阅 比如说 安装存储CLI扩展。请注意,CLI版本应大于2.0.67 剧本 蟒蛇 try: file_system_client = service_client.get_file_system_cli
根据我的研究,我们可以使用Azure CLI或python来移动目录或文件。有关更多详细信息,请参阅 比如说
try:
file_system_client = service_client.get_file_system_client(file_system="my-file-system")
directory_client = file_system_client.get_directory_client("my-directory")
new_dir_name = "my-directory-renamed"
directory_client.rename_directory(rename_destination=directory_client.file_system_name + '/' + new_dir_name)
except Exception as e:
print(e)
谢谢,您在python示例中使用了什么库?@fuggy_-yama关于python sdk,请参考@fuggy_-yama您还有其他问题吗?@fuggy_-yama由于您没有其他问题,请。它可能会帮助更多的人。我刚刚意识到这是移动操作,我实际上需要在ADLS gen2中复制文件。这里有同样的问题
# move directory
az storage blob directory move -c my-file-system -d my-new-directory -s my-directory --account-name mystorageaccount
# move a file
az storage blob move -c my-file-system -d my-file-new.txt -s my-file.txt --account-name mystorageaccount
try:
file_system_client = service_client.get_file_system_client(file_system="my-file-system")
directory_client = file_system_client.get_directory_client("my-directory")
new_dir_name = "my-directory-renamed"
directory_client.rename_directory(rename_destination=directory_client.file_system_name + '/' + new_dir_name)
except Exception as e:
print(e)