From 49e0ba55b4d65a166edc1a7e042b063e3c57fff5 Mon Sep 17 00:00:00 2001 From: Nick Ortakales Date: Thu, 9 Oct 2025 10:46:14 -0700 Subject: [PATCH] Validate that file directories are at least: Language/Category/* --- scripts/validate_files.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/validate_files.sh b/scripts/validate_files.sh index 5a200d6..023116e 100755 --- a/scripts/validate_files.sh +++ b/scripts/validate_files.sh @@ -30,7 +30,8 @@ FORBIDDEN_PATTERNS=( ) FILE_AND_DIR_ALLOWED_CHARACTERS="A-Za-z0-9().,!%&+ -"; -FILE_AND_DIR_REGEX="^\.[$FILE_AND_DIR_ALLOWED_CHARACTERS/]+\/[$FILE_AND_DIR_ALLOWED_CHARACTERS]+\.nfc$" +# Not the most elegant regex, but ensure files are at least 2 directories deep +FILE_AND_DIR_REGEX="^\.\/(English|German|French)\/[$FILE_AND_DIR_ALLOWED_CHARACTERS/]+\/[$FILE_AND_DIR_ALLOWED_CHARACTERS]+\.nfc$" # Use process substitution so that ERROR_FOUND is updated in the main shell. while read -r filename; do @@ -38,7 +39,7 @@ while read -r filename; do if ! echo "$filename" | awk "/$FILE_AND_DIR_REGEX/ { found=1 } END { exit !found }"; then echo "$filename" - echo " Filename has invalid characters or missing .nfc extension. Allowed characters are $FILE_AND_DIR_ALLOWED_CHARACTERS" + echo " Filename has invalid characters, missing .nfc extension, or is not at least 2 directories deep (e.g. English/Paw Patrol/). Allowed characters are $FILE_AND_DIR_ALLOWED_CHARACTERS" ERROR_FOUND=1 fi