Skip to content

Commit 73e1f5a

Browse files
committed
Add script to prune extraneous .keep files
1 parent ca92e31 commit 73e1f5a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

scripts/prune-extra-keep-files.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
for EXERCISE_DIRECTORY in $(find exercises -mindepth 2 -maxdepth 2 -type d -name "src"); do
4+
STARTER_DIRECTORY="${EXERCISE_DIRECTORY}/main/java"
5+
STARTER_FILE_COUNT=$(find "${STARTER_DIRECTORY}" -mindepth 1 -maxdepth 1 -type f -name "*.java" | wc -l)
6+
KEEP_FILE_LOCATION="${STARTER_DIRECTORY}/.keep"
7+
8+
if (( ${STARTER_FILE_COUNT} > 0 )) && [[ -f "${KEEP_FILE_LOCATION}" ]]; then
9+
echo "Removing unnecessary keep file ${KEEP_FILE_LOCATION}..."
10+
rm "${KEEP_FILE_LOCATION}"
11+
fi
12+
done

0 commit comments

Comments
 (0)