On branch rewrite-2022-03-26
Your branch is up to date with 'origin/rewrite-2022-03-26'. Changes to be committed: modified: hash-files Comment cleanup, output cleanup
This commit is contained in:
parent
ddc61edccd
commit
01faecccda
17
hash-files
17
hash-files
@ -15,8 +15,6 @@ set +a
|
||||
############
|
||||
|
||||
write_log () {
|
||||
#echo " ++ Write to log.
|
||||
# +++++++++++++++"
|
||||
## Use on systems managed with systemd
|
||||
# printf 'hash-files: %s\n' "$1" | systemd-cat
|
||||
printf '%s hash-files: %s\n' "$DateTimeStamp" "$1" >> $log_file
|
||||
@ -37,7 +35,7 @@ mdls_per_file () {
|
||||
mdls_properties+=( $mdls_value )
|
||||
unset IFS
|
||||
else
|
||||
: #echo "Did not print!"
|
||||
: # "Did not print!"
|
||||
fi
|
||||
IFS=$old_IFS
|
||||
done
|
||||
@ -46,7 +44,7 @@ mdls_per_file () {
|
||||
|
||||
|
||||
write_per_file () {
|
||||
#echo "=== Write data to a .csv file. ===
|
||||
# "=== Write data to a .csv file. ===
|
||||
#===================================="
|
||||
# cat $temp_csv_file
|
||||
# write_log "$temp_csv_file written successfully."
|
||||
@ -62,26 +60,25 @@ cleanup () {
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "Main Start"
|
||||
## Create temp file
|
||||
temp_csv_file=$($mktemp_bin)
|
||||
## Initialize column names
|
||||
csv_columns=( "File Path" "File Hash" )
|
||||
## Populate Columns from keys of interest
|
||||
echo "Keys of interest:"
|
||||
echo ${keys_of_interest[@]}
|
||||
echo "==========================================="
|
||||
for key in ${keys_of_interest[@]};do
|
||||
csv_columns+=( $key )
|
||||
done
|
||||
## Print columns to first line of csv
|
||||
#echo "======= CSV Columns ========"
|
||||
# "======= CSV Column Headers ========"
|
||||
{ IFS=',';echo "${csv_columns[*]}";IFS=$'\n'
|
||||
## Loop through files, writing to csv
|
||||
for file in $(find $Working_Fullpath -maxdepth 1 -type f); do
|
||||
## Set our hash value
|
||||
hash=$($md5_bin $file | awk '{ print $4 }')
|
||||
## Set our mdls values
|
||||
mdls_per_file $file
|
||||
# echo "============= CSV Row =========="
|
||||
# Print csv row output
|
||||
# "============= CSV Row =========="
|
||||
echo "$file,$hash,$mdls_properties"
|
||||
# write_per_file $file $hash $mdls_properties
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user