Compare commits

...

3 Commits

Author SHA1 Message Date
Michael Holloway b1db7f1a68 Changes to be committed: 3 years ago
Michael Holloway 86a47efc6e On branch output-file 3 years ago
Michael Holloway 9ffd223048 On branch docs-minimal 3 years ago
  1. 8
      LICENSE
  2. 21
      README.md
  3. 10
      mdlspipe

@ -0,0 +1,8 @@
Copyright (c) Michael Holloway, 2022
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@ -0,0 +1,21 @@
mdlspipe
========
v0.1.1
Supported Platforms: Mac OS X
Provided a directory (default is current directory), capture particular
fields of `mdls` output for each file in provided directory in a csv.
Usage
-----
Run directly:
./mdlspipe
Place mdlspipe in your $PATH and run from $PWD.
By default, mdlspipe will write the output data to a csv called
'mdlspipe_YYYY-MM-DD_HH-MM-SS.csv'.

@ -1,5 +1,7 @@
#!/usr/bin/env bash
log_file=/var/log/hash-files.log
log_file=/var/log/mdlspipe.log
Working_Fullpath=$(pwd)
Working_Directory=$(basename $Working_Fullpath)
keys_of_interest=("kMDItemFSCreationDate" "kMDItemFSName")
md5_bin=$(which md5sum)
mktemp_bin=$(which mktemp)
@ -16,8 +18,8 @@ set +a
write_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
# printf 'mdlspipe: %s\n' "$1" | systemd-cat
printf '%s mdlspipe: %s\n' "$DateTimeStamp" "$1" >> $log_file
}
@ -81,5 +83,5 @@ for file in $(find $Working_Fullpath -maxdepth 1 -type f); do
# write_per_file $file $hash $mdls_properties
done
} >> $temp_csv_file
cat $temp_csv_file
unset IFS
mv $temp_csv_file $PWD/mdlspipe_$(date +%\D_\%T|sed 's/[:|\/]/-/g').csv
Loading…
Cancel
Save