1

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

Sakshi
  • 13
  • 1
  • 6

1 Answers1

1

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?

Community
  • 1
  • 1
Rijul
  • 1,418
  • 11
  • 21