Skip to content

Commit

Permalink
Merge pull request #418 from exercism/prune-extra-keep-files
Browse files Browse the repository at this point in the history
Add script to prune extraneous .keep files
  • Loading branch information
jtigger authored Apr 14, 2017
2 parents 0ac6f63 + 73e1f5a commit 7c4dea9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/prune-extra-keep-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

for EXERCISE_DIRECTORY in $(find exercises -mindepth 2 -maxdepth 2 -type d -name "src"); do
STARTER_DIRECTORY="${EXERCISE_DIRECTORY}/main/java"
STARTER_FILE_COUNT=$(find "${STARTER_DIRECTORY}" -mindepth 1 -maxdepth 1 -type f -name "*.java" | wc -l)
KEEP_FILE_LOCATION="${STARTER_DIRECTORY}/.keep"

if (( ${STARTER_FILE_COUNT} > 0 )) && [[ -f "${KEEP_FILE_LOCATION}" ]]; then
echo "Removing unnecessary keep file ${KEEP_FILE_LOCATION}..."
rm "${KEEP_FILE_LOCATION}"
fi
done

0 comments on commit 7c4dea9

Please sign in to comment.