summaryrefslogtreecommitdiff
path: root/bin/extra/wipe
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-14 11:50:41 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-14 11:50:41 +0200
commit67a2df82d25f52ea0937f4eed355546deae7b4b5 (patch)
tree40bc358a6d2a6b119e04229b48fd05dd74a5b81d /bin/extra/wipe
parent4fbb921cd8a9da0135e0ddf54da898e080cc8c7e (diff)
parentb0ef0738b3f0cebde9ed6b1d40ca0f7cbb1385a3 (diff)
Merge branch 'main' of /var/git/dotfiles
Diffstat (limited to 'bin/extra/wipe')
-rwxr-xr-xbin/extra/wipe13
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."