Saturday 2 January 2016

Hadoop: touchz: create a file of zero length

“touchz” command is used to create a file of zero length.

Usage:
hadoop fs [generic options] -touchz <path> ...


$ hadoop fs -touchz /user/harikrishna_gurram/file1.txt /user/harikrishna_gurram/file2.txt /user/harikrishna_gurram/file3.txt
$ 
$ hadoop fs -ls /user/harikrishna_gurram/
Found 7 items
drwxr-xr-x   - harikrishna_gurram supergroup          0 2015-06-18 15:06 /user/harikrishna_gurram/dir1
drwxr-xr-x   - harikrishna_gurram supergroup          0 2015-06-18 15:06 /user/harikrishna_gurram/dir2
-rw-r--r--   3 harikrishna_gurram supergroup          0 2015-06-18 16:25 /user/harikrishna_gurram/file1.txt
-rw-r--r--   3 harikrishna_gurram supergroup          0 2015-06-18 16:25 /user/harikrishna_gurram/file2.txt
-rw-r--r--   3 harikrishna_gurram supergroup          0 2015-06-18 16:25 /user/harikrishna_gurram/file3.txt
drwxr-xr-x   - harikrishna_gurram supergroup          0 2015-06-18 14:54 /user/harikrishna_gurram/first
-rw-r--r--   3 harikrishna_gurram supergroup        973 2015-06-18 16:21 /user/harikrishna_gurram/sample.zip

hadoop fs -touchz /user/harikrishna_gurram/file1.txt /user/harikrishna_gurram/file2.txt /user/harikrishna_gurram/file3.txt


Above command creates files “file1.txt”, “file2.txt”, and “file3.txt” of size zero.



Previous                                                 Next                                                 Home

No comments:

Post a Comment