You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Temporary cache file now only created if file count > 0
* Updated verbosity messages
* Variable name changes to try and clarify purpose
* Additional source code descriptions relating to UTF-8 sorting issue
across platforms (e.g. OSX compared to Ubuntu)
if [ "$valVerbose"= True ];thenecho -n -e "${ggcLightPurple}Scanning for entries:${ggcNC}";fi
243
238
244
-
# Hideous sorting technique has to be done due to the way that OSX differs from Linux on UTF-8
245
-
unset FILEHASHLIST i f
239
+
# Hideous sorting technique has to be done due to the way that -nix systems (e.g. OSX and Linux) differ from each other on UTF-8 and sorting
240
+
# Check git history to see the various attempts I was making with combinations of `find` piped to `sort`
241
+
unset fileItems i f
246
242
while IFS= read -r -d $'\0' f;do
247
-
FILEHASHLIST[i++]="$f"
243
+
244
+
# Skip: invalid file entry
245
+
if [ -z"${f}" ] || [ !-f"${f}" ];thencontinue;fi
246
+
247
+
fileItems[i++]="$f"
248
248
done<<( python -c "import os, sys; fdl=[os.path.join(dp, f) for dp, dn, filenames in os.walk('.') for f in filenames]; sys.stdout.write('\0'.join( sorted( [ x for x in fdl if os.path.basename(x) not in [ '.DS_Store', 'Icon\r' ] ], key=lambda s: s.lower() ) )+'\0' )")
249
249
unset i f
250
250
251
-
fileItems=${#FILEHASHLIST[@]}
251
+
# Total size of array
252
+
fileItemSize=${#fileItems[@]}
253
+
254
+
# Display count
255
+
if [ "$valVerbose"= True ];thenecho -e "${ggcLightBlue}${fileItemSize}${ggcNC}";echo;fi
256
+
257
+
# Directory contains 0 (nested) files.
258
+
if [ "$fileItemSize"-eq 0 ];then
259
+
echo -e "${ggcLightRed}There are no (nested) files in directory '${valTarget}' to check. Exiting.${ggcNC}">&2
0 commit comments