Browse Source

bin: add `delete-all` to find and delete `delete-me` directories

Signed-off-by: Alejandro Mery <amery@hanoverdisplays.com>
master
Alejandro Mery 5 years ago
committed by Alejandro Mery
parent
commit
a092c14862
1 changed files with 25 additions and 0 deletions
  1. +25
    -0
      files/bin/delete-all

+ 25
- 0
files/bin/delete-all

@ -0,0 +1,25 @@
#!/bin/sh
if [ $# -eq 0 ]; then
set -- "$HOME/projects"
fi
find_delete_me() {
local depth="$1" x=
shift
for x; do
if [ ! -e "$x" ]; then
:
elif [ "${x##*/}" = "delete-me" ]; then
echo "$x"
elif [ $depth -gt 0 ]; then
find_delete_me $(( depth - 1 )) "$x"/*
fi
done
}
find_delete_me 4 "$@" | while read x; do
echo "# $x"
rm -rf "$x"
done

Loading…
Cancel
Save