Skip to content

Instantly share code, notes, and snippets.

@Pixailz
Created December 6, 2023 12:53
Show Gist options
  • Save Pixailz/3fcbd8d4a227e0ff73c5129f3481e1a2 to your computer and use it in GitHub Desktop.
Save Pixailz/3fcbd8d4a227e0ff73c5129f3481e1a2 to your computer and use it in GitHub Desktop.
clean for release
#!/bin/bash -ue
# Author: Pixailz
PATTERN=(
"\.git*"
"\.vscode"
"__pycache__"
"*\.o"
"*\.a"
)
: ${1?}
TARGET="${1}"
for pat in ${PATTERN[@]}; do
founded=($(find "${TARGET}" -name "${pat}" -print))
if [ "${#founded[@]}" == "0" ]; then
printf "[%b] pattern [%s] found nothing\n" "\x1b[32m*\x1b[0m" "${pat}"
else
rm -rf ${founded[@]}
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment