From 2fad2973d0d4140fa79d28051064df04a8fa692c Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Sun, 20 Feb 2022 05:17:05 +0300 Subject: [PATCH] Added utility script --- scripts/check_numeric_filenames.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 scripts/check_numeric_filenames.sh diff --git a/scripts/check_numeric_filenames.sh b/scripts/check_numeric_filenames.sh new file mode 100755 index 0000000..7717982 --- /dev/null +++ b/scripts/check_numeric_filenames.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# check_numeric_filenames.sh +# Konstantin Pavlov, pavlovconst@gmail.com +# +# simple utility script is useful whe thew directory holds enumerated files and +# you want to check that there is no missing files in the sequence + + +# serching filenames with pattrn "001*", "002*", "003*" and so on up to "905*" +# you get a prompt if any file is missing +for i in $(seq -f "%03g" 1 905) +do + echo -n "$i " + if test -n "$(find . -maxdepth 1 -name "$i *" -print -quit)" + then + echo "" #"exists" + else + echo "ERR: $i file doesn't exist" + fi +done \ No newline at end of file