Last active
October 7, 2020 23:40
-
-
Save cameronjonesweb/11acf7a1c5ea923a6d6ec7f23aac87c9 to your computer and use it in GitHub Desktop.
Recursively creates an index.php file in all subfolders that don't include an index.php file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shopt -s globstar | |
for i in **; do | |
if [ -d "$i" ]; then | |
# update this line to include directories to ignore | |
if [[ "${i##/*}" != *"node_modules"* && "${i##/*}" != *"bower_components"* ]]; then | |
if [ ! -f "${i##/*}/index.php" ]; then | |
printf "Creating index file in %s\n" "${i##/*}" | |
printf "<?php\n// Silence is golden." > ${i##/*}/index.php | |
fi | |
fi | |
fi | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment