From 01af15d2755af6d70e19f6a941d2c8a3b68299da Mon Sep 17 00:00:00 2001 From: wilhelmagren Date: Wed, 13 Sep 2023 21:39:02 +0200 Subject: [PATCH] chore(cc) clear pycache scripts for powershell --- scripts/cc.ps1 | 3 +++ scripts/cc.sh | 20 ++++++++++++++++++++ scripts/rc.sh | 22 ---------------------- 3 files changed, 23 insertions(+), 22 deletions(-) create mode 100644 scripts/cc.ps1 create mode 100644 scripts/cc.sh delete mode 100644 scripts/rc.sh diff --git a/scripts/cc.ps1 b/scripts/cc.ps1 new file mode 100644 index 0000000..35f8ac5 --- /dev/null +++ b/scripts/cc.ps1 @@ -0,0 +1,3 @@ +Write-Host -NoNewLine "Removing __pycache__/ recursively..." +Get-ChildItem -Include __pycache__ -Recurse -force | Remove-Item -Force -Recurse +Write-Host "OK" \ No newline at end of file diff --git a/scripts/cc.sh b/scripts/cc.sh new file mode 100644 index 0000000..185ac59 --- /dev/null +++ b/scripts/cc.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +function traverse() { + for file in "$1"/* + do + if [ ! -d "${file}" ] ; then + continue + else + if [[ "${file}" == *"pycache"* ]] ; then + rm -rf "${file}" + else + traverse "${file}" + fi + fi + done +} + +printf "Removing __pycache__/ recursively..." +traverse "." +printf "OK\n" \ No newline at end of file diff --git a/scripts/rc.sh b/scripts/rc.sh deleted file mode 100644 index 7124ca7..0000000 --- a/scripts/rc.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# Remove the Cpython created binaries from __pycache__ -# recursively from the root directory. Use with care, -# will invoke `rm -rf` and remove everything named *pycache*. - -function traverse() { - for file in "$1"/* - do - if [ ! -d "${file}" ]; then - continue - else - if [[ "${file}" == *"pycache"* ]]; then - rm -rf "${file}" - else - traverse "${file}" - fi - fi - done -} - -echo "Revoming all __pycache__ directories from $PWD" -traverse "."