I need to rename a directory in hdfs. What is the command for that ?
hadoop fs -mv <src> <dest>
The above command moves the src folder into dest folder. Instead of, I want the src
folder to be renamed as dest
.
Changing the owner of files in the HDFS: Firstly, switch to root user from ec2-user using the “sudo -i” command. And let us create a directory in the HDFS by changing it as the HDFS user.
Renaming is the way to move files on HDFS: FileSystem. rename(). Actually, this is exactly what the HDFS shell command "-mv" does as well, you can check it in the source code.
If you type hdfs dfs -ls / you will get list of directories in hdfs.
Rename is not in hadoop, but you can move, hadoop fs -mv oldname newname
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With