changes accidentally checked into main branch
[feisty_meow.git] / scripts / files / find_newest_files.sh
1 #!/bin/bash
2
3 # find the most recently updated files in a folder.
4 # made friendlier for dell by avoiding the .clusterConfig directory and for
5 # netapp by avoiding the .snapshot directory.
6
7 declare -a paths=("${@}")
8 echo "paths 1 now is: ${paths[@]}"
9 if [ ${#paths} -eq 0 ]; then
10   paths[0]='.'
11 fi
12 echo "paths 2 now is: ${paths[@]}"
13
14 for pathname in "${paths[@]}"; do
15
16   echo ===============
17   echo newest on path: $pathname
18   echo ===============
19   echo
20  
21   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
22
23   echo; echo
24
25 done
26