feat(bktess):Add bash wrapper for tesseract img OCR
[BK-2020-03.git] / sysutils / bklowerBeforeDoubleDotinDirName.sh
1 #!/bin/bash
2 #Desc:Lowercases portion of directory names preceding '..'
3 #Usage: lowerBeforeDoubleDotinDirName.sh
4 #Example case: If working directory contains directory named
5 # '0xDEADBEEF..Human description', it is renamed
6 # '0xdeadbeef..Human description'.
7
8 for dirSlash in ./*; do
9 if [[ -d $dirSlash ]]; then
10 echo "dirSlash:$dirSlash";
11 dir="$(basename "$dirSlash")";
12 echo "dir:$dir";
13 first="${dir%..*}";
14 echo "first:$first";
15 second="${dir#*..}";
16 echo "second:$second";
17 firstNoCaps="$(echo "$first" | tr '[:upper:]' '[:lower:]')";
18 echo "firstNoCaps:$firstNoCaps";
19 newPath=./"$firstNoCaps".."$second";
20 echo "newPath=$newPath";
21 echo "===========================";
22 mv "$dirSlash" "$newPath";
23 fi;
24 done