az dls fs move的正确语法?

时间:2019-06-18 22:42:36

标签: python azure azure-cli

我正在尝试使用azcli工具将某些文件从ADLS中的一个目录移动到另一个目录。

这是我的命令:

az dls fs move --account <my dlsname> --source-path /temp/ -- 
destination-path /temp/ymd=2019-05-31/

这是我不断收到的错误:

The command failed with an unexpected error. Here is the traceback:

Operation failed: RENAME, temp
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.0.64/libexec/lib/python3.7/site-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.0.64/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 560, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.0.64/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 618, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/Cellar/azure-cli/2.0.64/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 611, in _run_job
    six.reraise(*sys.exc_info())
  File "/usr/local/Cellar/azure-cli/2.0.64/libexec/lib/python3.7/site-packages/six.py", line 693, in reraise
    raise value
  File "/usr/local/Cellar/azure-cli/2.0.64/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 588, in _run_job
    result = cmd_copy(params)
  File "/usr/local/Cellar/azure-cli/2.0.64/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 297, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.0.64/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 453, in default_command_handler
    return op(**command_args)
  File "/usr/local/Cellar/azure-cli/2.0.64/libexec/lib/python3.7/site-packages/azure/cli/command_modules/dls/custom.py", line 251, in move_adls_item
    client.mv(source_path, destination_path)
  File "/usr/local/Cellar/azure-cli/2.0.64/libexec/lib/python3.7/site-packages/azure/datalake/store/core.py", line 536, in mv
    destination=path2.as_posix())
  File "/usr/local/Cellar/azure-cli/2.0.64/libexec/lib/python3.7/site-packages/azure/datalake/store/lib.py", line 458, in call
    self.log_response_and_raise(response, err)
  File "/usr/local/Cellar/azure-cli/2.0.64/libexec/lib/python3.7/site-packages/azure/datalake/store/lib.py", line 344, in log_response_and_raise
    raise exception
azure.datalake.store.exceptions.DatalakeRESTException: Operation failed: RENAME, temp

与此相关的文档也很简短:https://docs.microsoft.com/en-us/cli/azure/dls/fs?view=azure-cli-latest#az-dls-fs-move

我在此命令上得到了许多变化。我必须在这里的语法上缺少一些内容。

1 个答案:

答案 0 :(得分:0)

@Josh,

我尝试了相同的代码,并且对我有用,我尝试了move命令的两个变体:

enter image description here

以下是确切的命令:

az login
az account set --subscription 'subscriptionid'
# move the complete folder    
az dls fs move --account 'accountName'--destination-path '/mvdest' --source-path '/destination'    
#move the file    
az dls fs move --account 'accountName'--destination-path '/destination/test.txt' --source-path '/source/test.txt'

以下是相同的输出:

enter image description here

使用此命令之前,请确保您具有正确的特权集。

希望有帮助。