shell - Copy all files in hadoop directory except 1 -


i writing shell script put files in hadoop directory.

i used command:

hadoop dfs -put /opt/nikoo28/resources/conf ./ 

now copies folder conf in hadoop home directory overwriting everything.

however, there 1 file, "donotcopy.txt" not want copy. there method can skip particular file?

add these lines in shell script:

mkdir /opt/copy mv /opt/nikoo28/donotcopy.txt /opt/copy/donotcopy.txt hadoop dfs -put /opt/nikoo28/resources/conf ./ && mv /opt/copy/donotcopy.txt /opt/nikoo28/donotcopy.txt 

just move file don't want copy other folder. perform hadoop fs -put command. now, move file original position.

if want preserve file permissions, this:

mkdir /opt/copy cp -p /opt/nikoo28/donotcopy.txt /opt/copy/donotcopy.txt rm /opt/nikoo28/donotcopy.txt hadoop dfs -put /opt/nikoo28/resources/conf ./ && cp -p /opt/copy/donotcopy.txt /opt/nikoo28/donotcopy.txt 

note: add sudo if permission errors while creating directory, moving file or copying file.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -