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 Moving csv file preparation outside per-file loop.
This commit is contained in:
parent
f32e7b9242
commit
c9d13e3a25
24
hash-files
24
hash-files
@ -46,16 +46,6 @@ mdls_per_file () {
|
||||
write_per_file () {
|
||||
#echo "=== Write data to a .csv file. ===
|
||||
#===================================="
|
||||
## Create temp file
|
||||
temp_csv_file=$($mktemp_bin)
|
||||
## Initialize column names
|
||||
csv_columns=( "File Path" "File Hash" )
|
||||
## Populate Columns from keys of interest
|
||||
for key in ${keys_of_interest[@]};do
|
||||
csv_columns+=( ${keys_of_interest[key]} )
|
||||
done
|
||||
## Print columns to first line of csv
|
||||
IFS=',';echo "${csv_columns[*]}";IFS=$'\n'
|
||||
# cat $temp_csv_file
|
||||
# write_log "$temp_csv_file written successfully."
|
||||
}
|
||||
@ -70,11 +60,21 @@ cleanup () {
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "Main Start"
|
||||
#echo "=== Get list of files in $Working_Directory. ===
|
||||
#=================================================="
|
||||
## Create temp file
|
||||
temp_csv_file=$($mktemp_bin)
|
||||
## Initialize column names
|
||||
csv_columns=( "File Path" "File Hash" )
|
||||
## Populate Columns from keys of interest
|
||||
for key in ${keys_of_interest[@]};do
|
||||
csv_columns+=( ${keys_of_interest[key]} )
|
||||
done
|
||||
## Print columns to first line of csv
|
||||
IFS=',';echo "${csv_columns[*]}";IFS=$'\n'
|
||||
## Loop through files, writing to csv
|
||||
for file in $(find $Working_Fullpath -maxdepth 1 -type f); do
|
||||
hash=$($md5_bin $file | awk '{ print $1 }')
|
||||
mdls_properties=$(mdls_per_file $file)
|
||||
|
||||
write_per_file $file $hash $mdls_properties
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user