Reputation: 13
How to rename multiple files in HDFS
200 files are present under directory /warehouse/bigdata/data, I want to append "_d" in all file name
Is there any way to do it in one go?
For Example: /warehouse/bigdata/data/test to /warehouse/bigdata/data/test_d
Upvotes: 1
Views: 9808
Reputation: 1445
First of all you can not rename a directory of file in hadoop/HDFS
but you can do :
Hadoop fs -mv /warehouse/bigdata/data/test /warehouse/bigdata/data/test_d
If you want to do this for all your 200 HDFS part files then you have to write Shell/bash script to do this in recursive loop.
just write above hadoop command in shell loop.
follow this: https://www.cyberciti.biz/tips/renaming-multiple-files-at-a-shell-prompt.html
and this how to rename all file in a folder with a prefix in a single unix command?
Upvotes: 2