X-Git-Url: https://feistymeow.org/gitweb/?p=feisty_meow.git;a=blobdiff_plain;f=scripts%2Ffiles%2Ffind_newest_files.sh;fp=scripts%2Ffiles%2Ffind_newest_files.sh;h=04a1944c647b5a8f7fe0f44a8626196f6921ff2a;hp=0000000000000000000000000000000000000000;hb=f7c28dab06ee47d0f28e97ed98cecb400f5aa2cc;hpb=5997acfad6af37e0e895774c95ecd0f6bd53dcfc diff --git a/scripts/files/find_newest_files.sh b/scripts/files/find_newest_files.sh new file mode 100755 index 00000000..04a1944c --- /dev/null +++ b/scripts/files/find_newest_files.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# find the most recently updated files in a folder. +# made friendlier for dell by avoiding the .clusterConfig directory and for +# netapp by avoiding the .snapshot directory. + +declare -a paths=("${@}") +echo "paths 1 now is: ${paths[@]}" +if [ ${#paths} -eq 0 ]; then + paths[0]='.' +fi +echo "paths 2 now is: ${paths[@]}" + +for pathname in "${paths[@]}"; do + + echo =============== + echo newest on path: $pathname + echo =============== + echo + + find "$pathname" -path "$pathname/.clusterConfig" -prune -o -path "$pathname/.snapshot" -prune -o -type f -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr | cut -d: -f2- | head -n 20 + + echo; echo + +done +