summaryrefslogtreecommitdiff
path: root/bin/extra/wipe
blob: ec2abe98e2ae46071f5cee92229151dabe4f19ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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."