I am writing a bash script that scans HDFS and do stuff with the output.
Fetching file names is easy with the following:
for line in $(hdfs dfs -ls -t -r -C -R $HDFS_CLEANING_STG); do
echo $line
done
Output:
/dir
/dir/file1
/dir/file2
However, it removes the file size, date, rights, etc.
With the same method but without the -C
flag, it gives the metadata but not on one line only:
Output example:
-rw-rw-r--+
3
hdfs
hdfs
34448169
2020-05-04
11:36
/dir/file
I would like to get these information, but with this output (like a "normal" ls
):
-rw-rw-r--+ 3 hdfs hdfs 34448169 2020-05-04 11:36 /dir/file
How can I achieve that ?