I'm using Azure Data Lake Gen2 and I have a folder named myfolder with 1000s of files. Is there a command on the Azure Storage CLI for renaming the folder and/or move the entire folder to another location of the ADLS Gen2?
Inside Azure Databricks I can easily leverage the linux mv bash command:
mv myfolder newname
for renaming myfoldermv myfolder /dbfs/mount/myadls/target/
for moving myfolder to a target folder.Is there a simple way of doing the same with the Azure CLI?
UPDATE: An ADLS Gen2 CLI is now available
We can rename or move a directory by using the az storage fs directory move
command.
Example 1: Renaming a directory from the name my-directory
to the name my-new-directory
in the same file system:
az storage fs directory move -n my-directory -f my-file-system --new-directory "my-file-system/my-new-directory" --account-name mystorageaccount --auth-mode login
Example 2: This example moves a directory to a file system named my-second-file-system
.
az storage fs directory move -n my-directory -f my-file-system --new-directory "my-second-file-system/my
For more info, here's the official documentation.