From d40ed99c3b8a6f28507a8e2db0a3238916db00e5 Mon Sep 17 00:00:00 2001 From: Brandon Rodriguez <brodriguez8774@gmail.com> Date: Tue, 28 Feb 2023 00:41:39 -0500 Subject: [PATCH] Minor updates to script, to be more general-use --- clear_pycache.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/clear_pycache.sh b/clear_pycache.sh index 24293b8..824efe7 100755 --- a/clear_pycache.sh +++ b/clear_pycache.sh @@ -19,23 +19,19 @@ text_reset="\033[0m" text_blue="\033[0;34m" -# Standardize current terminal path so script runs consistently, regardless of original terminal location. -cd "$(dirname "$0")"/.. - - function main () { # Get absolute path of current folder. current_folder="$(cd "$(dirname "${1}")" && pwd)/$(basename "${1}")" - echo -e "${text_blue}Starting Directory: \"${current_folder}\"${text_reset}" - echo "" - echo "Removing auto-generated files in PyCache directories:" + # echo -e "${text_blue}Starting Directory: \"${current_folder}\"${text_reset}" + # echo "" + echo -e "${text_blue}Removing auto-generated files in PyCache directories...${text_reset}" # Start with current directory, which should be project root. Pass in absolute path as start point. iterate_dir ${current_folder} - echo "" - echo -e "${text_blue}PyCache directories cleared. Terminating script.${text_reset}" + # echo "" + echo -e "${text_blue}PyCache directories cleared.${text_reset}" } @@ -55,7 +51,7 @@ function iterate_dir () { if [[ "${dir_name}" == "__pycache__" ]] then # Is PyCache directory. Check all files within. - echo " ${dir}" + # echo " ${dir}" for file in "${dir}/"* do # Check if value is actually a file. @@ -66,7 +62,7 @@ function iterate_dir () { if [[ "${file_extension}" == "pyc" ]] then # Is confirmed PyCache file. These are automatically generated so we can simply delete it. - rm ${file} + rm ${file} > /dev/null 2>&1 fi fi done -- GitLab