diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-13 02:08:33 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-13 02:08:33 +0200 |
commit | 818dabae65e67cb52f11623ab1e76ad4c85c19e1 (patch) | |
tree | 5c508f03e2718fc786edb0ed82f9fab49bb00e97 /bin/extra/wipe | |
parent | 5eed72797eaf9ec0d0e43b24add8b266b1999b08 (diff) |
added confirm, trl and wipe scripts!
Diffstat (limited to 'bin/extra/wipe')
-rwxr-xr-x | bin/extra/wipe | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/extra/wipe b/bin/extra/wipe new file mode 100755 index 0000000..ec2abe9 --- /dev/null +++ b/bin/extra/wipe @@ -0,0 +1,13 @@ +#!/bin/sh +[ 0 -eq "$#" ] && >&2 echo 'usage: wipe <file>' && exit 1 +[ ! -f "$1" ] && [ ! -d "$1" ] && >&2 echo "'$1' not found." && exit 1 + +confirm "sure?" || exit 1 +>&2 printf "\n" + +find "$1" -type f -print0 | + xargs -0I{} shred -uz "{}" && + [ -d "$1" ] && # remove leftovver empty directories + find "$1" | tac | tr '\n' '\0' | + xargs -0I{} rm -d "{}" && + >&2 echo "wiped." |