chore(user/bk-gpgfp-noemail):make executable
[BK-2020-03.git] / sysutils / bkStConflictFinder.sh
1 #!/bin/bash
2 # Desc: Identifies `sync-conflict` files in specified directory
3 # recursively.
4 # Usage: syncthingConflictFinder.sh arg1
5 # Example: syncthingConflictFinder.sh "$HOME/Sync/"
6 # Input: arg1 [path of dir to search recursively]
7 # Version: 0.1.0
8
9 arg1="$1"; # Get argument 1
10
11 # Validate dir
12 if [ -d "$arg1" ]; then
13 searchDir="$arg1";
14 echo "DEBUG:searchDir:$searchDir" 1>&2;
15 else
16 echo "ERROR:Not a dir:$arg1" 1>&2; exit 1;
17 fi;
18
19 # List `sync-conflict` files.
20 find -L "$searchDir" -type f -iname "*sync-conflict*" -exec du -h {} \; 2>/dev/null;
21
22 # List `sync-conflict` files of size 1 MB to 999 GB.
23 #find -L "$searchDir" -type f -iname "*sync-conflict*" -exec du -h {} \; 2>/dev/null | grep "G \|M ";
24
25
26 #==License Info==
27 # Author: Steven Baltakatei Sandoval (reboil.com)
28 # License: GPLv3+
29
30 #===Dependency Version Information===
31 # find (GNU findutils) 4.6.0.225-235f
32 # Copyright (C) 2019 Free Software Foundation, Inc.
33 # License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
34 # This is free software: you are free to change and redistribute it.
35 # There is NO WARRANTY, to the extent permitted by law.
36
37 # Written by Eric B. Decker, James Youngman, and Kevin Dalley.
38 # Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)
39
40
41 # grep (GNU grep) 3.3
42 # Copyright (C) 2018 Free Software Foundation, Inc.
43 # License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
44 # This is free software: you are free to change and redistribute it.
45 # There is NO WARRANTY, to the extent permitted by law.
46
47 # Written by Mike Haertel and others; see
48 # <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.