您好,欢迎来到保捱科技网。
搜索
您的当前位置:首页hadoop判断文件是否存在

hadoop判断文件是否存在

来源:保捱科技网


hadoop判断文件是否存在 在shell中判断一个HDFS目录/文件是否存在 直接看shell代码: hadoop fs -test -e /hdfs_dir if [ $? -ne 0 ]; then echo Directory not exists! fi hadoop fs -test -e 用于判断HDFS目录/文件是否存在,下一步检测该命令的返回值,以

hadoop判断文件是否存在

在shell中判断一个HDFS目录/文件是否存在

直接看shell代码:

hadoop fs -test -e /hdfs_dir

if [ $? -ne 0 ]; then

echo "Directory not exists!"

fi

hadoop fs -test -e 用于判断HDFS目录/文件是否存在,下一步检测该命令的返回值,以确定其判断结果。

-test -[ezd] : If file { exists, has zero length, is a directory

then return 0, else return 1.

e,z,d参数必用其一,不可缺少。

Copyright © 2019- baoaiwan.cn 版权所有 赣ICP备2024042794号-3

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务