user7590556
user7590556

Reputation:

How to create a file in `HDFS` dynamically

I want to create some files in HDFS dynamically based on the time stamp.

I can do this in Linux and create the files.

TIMESTAMP=`date "+%Y-%m-%d"`

touch /home/$USER/logs/${TIMESTAMP}.success_log

touch /home/$USER/logs/${TIMESTAMP}.fail_log

Is there a way to do this in HDFS. I would like to use this feature in shell scripts.

Please let me know.

Upvotes: 1

Views: 2617

Answers (1)

franklinsijo
franklinsijo

Reputation: 18300

hdfs dfs -touchz /home/$USER/logs/`date "+%Y-%m-%d"`.success_log

Or in your way,

TIMESTAMP=`date "+%Y-%m-%d"`
hdfs dfs -touchz /home/$USER/logs/${TIMESTAMP}.success_log

Upvotes: 1

Related Questions