I am using the stat commands to show information of all files in a directory, by using the below commands in a script:
stat -c"%n|%s|%y" <FOLDER>/* | sed -r 'h; s/\|.*$//; s/^/wc -l </e; G; s/\n/|/; s/^([^|]*\|)([^|]*\|)/\2\1/; s/( [^ ]*){1}$//;s#/#|#' > Stats.csv
It gives me file information in a pipe-delimited file, Folder Name | File Name | Row counts | File Size | Date files arrived
An example:
AVIL|Applicability_Master_100K.txt|100000|6264377|2019-05-23 12:51:45.454241257
AVIL|Vendor_Master_20190528.txt|22677|3950461|2019-05-29 13:49:43.465444584
AVIL|Sales_Order_20190527.txt|15056|4328799|2019-05-29 13:50:03.670264272
AVIL|Purchase_Order_20190529.txt|10110|1514505|2019-05-29 13:49:22.360588383
I want to change Mb to MB and get rid of milliseconds in the date column.
Thanks