count
Counts the number of directories, files and bytes under the paths that match the specified file pattern. Gets the quota and the usage.
The output columns with -count
are: DIR_COUNT, FILE_COUNT, CONTENT_SIZE, PATHNAME.
Returns 0
on success and -1
on error.
The usage is as follows:
$ hadoop fs -count [-q] [-h] [-v] [-x] [-t [<storage type>]] [-u] [-e] <paths>
-u |
Controls what columns the output contains: QUOTA, REMAINING_QUOTA, SPACE_QUOTA, REMAINING_SPACE_QUOTA, PATHNAME |
-q |
Controls what columns the output contains: QUOTA, REMAINING_QUOTA, SPACE_QUOTA, REMAINING_SPACE_QUOTA, DIR_COUNT, FILE_COUNT, CONTENT_SIZE, PATHNAME |
-t |
The list of possible parameters that can be used: |
-h |
Shows sizes in human-readable format |
-v |
Displays a header line |
-x |
Excludes snapshots from the result calculation. Without the |
-e |
Shows the erasure coding policy for each file |
-e |
Controls what columns the output contains: DIR_COUNT, FILE_COUNT, CONTENT_SIZE, |
-ERASURECODING_POLICY |
Name of the policy for the file. |
Examples:
$ hadoop fs -count hdfs://nn1.example.com/file1 hdfs://nn2.example.com/file2
$ hadoop fs -count -q hdfs://nn1.example.com/file1
$ hadoop fs -count -q -h hdfs://nn1.example.com/file1
$ hadoop fs -count -q -h -v hdfs://nn1.example.com/file1
$ hadoop fs -count -u hdfs://nn1.example.com/file1
$ hadoop fs -count -u -h hdfs://nn1.example.com/file1
$ hadoop fs -count -u -h -v hdfs://nn1.example.com/file1
$ hadoop fs -count -e hdfs://nn1.example.com/file1