Reputation: 21
Have some data stored in different directory paths in databricks file system. Need to rename some folders. Is it possible to rename folders in DBFS? If so, what's the command?
Upvotes: 2
Views: 12677
Reputation: 538
Use this. Just replace the path with your actual path.
old_name = r"dbfs:/FileStore/tables/PM/TC/ROBERTA"
new_name = r"dbfs:/FileStore/tables/PM/TC/BERT"
dbutils.fs.mv(old_name, new_name, True)
Upvotes: 2
Reputation: 1655
You can use mv
with %fs
magic, or dbutils.fs
to do this. This command is used for renaming and/or moving files and directories
%fs mv -r /path/to/folder /path/to/new_folder_name
the -r
is to do recursive move with directories.
It's documented in the dbutils. There is also more info here.
Upvotes: 2