I am running below command, tried to use either filename exists, or filename not exists, but none of them have any outputs from console. I expect if a file exists, the command should return zero?
http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/FileSystemShell.html#test
hadoop fs -test -e filename
I think it means the return code of the command is 0.
You can check with
hadoop fs -test -e filename
echo $?
Try
hadoop fs -test -d <HDFSFilename>
You should see test: File does not exists
If the file does not exists - and a blank string if it does
1=$(hadoop fs test -d <HDFSFilename>)
I am sure you are using a HDFS filename and not a Linux based filename - but best check
hadoop fs -ls /
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With