diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-14 11:50:41 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-14 11:50:41 +0200 |
commit | 67a2df82d25f52ea0937f4eed355546deae7b4b5 (patch) | |
tree | 40bc358a6d2a6b119e04229b48fd05dd74a5b81d /bin/extra/wipe | |
parent | 4fbb921cd8a9da0135e0ddf54da898e080cc8c7e (diff) | |
parent | b0ef0738b3f0cebde9ed6b1d40ca0f7cbb1385a3 (diff) |
Merge branch 'main' of /var/git/dotfiles
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." |