1
我想檢查文件是否存在於hdfs中。我使用檢查文件是否存在於帶有通配符的hdfs中
if $(hadoop fs -test -e $myfilewithpath) ; then echo "ok";else echo "not ok"; fi
現在我越來越喜歡
test: `/data/bi/udm/incoming/Viewership/year=2016/month=02/day=26/hour=07/part-m-*.avro': No such file or directory
not ok
該文件的錯誤消息,我的路我希望可以是任何映射器輸出文件即它可以是part-m-00000.avro
或者它可以是part-m-00099.avro
這就是爲什麼我在我的搜索part-m-*.avro
中使用*
。
但我們可以消除下面的消息,並得到唯一的輸出not ok
test: `/data/bi/udm/incoming/Viewership/year=2016/month=02/day=26/hour=07/part-m-*.avro': No such file or directory