Check if hdfs file exists

#!/bin/bash
HADOOP=$(which hadoop)
$HADOOP fs -test -e $1
if [ $? -eq 1 ]
then
$HADOOP fs -put $1 /
if [ $? -eq 0 ]
then
echo "the file $1 put successfully!"
fi
fi

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325384678&siteId=291194637