#! /bin/bash # # Shell skript for replacing the bytes of a file by zeros. # This is not a random application but derived from rmm and # good for simple clearing e. g. for hiberfil.sys, pagefile.sys etc.. # # For using another random number device than /dev/random change # the if-option of dd below. # # For a version with progress meter use dd_rescure or ddrescure. # # TODO: Version which works with special signs like newline in the file # name and which converts the file names with their absolute path # because otherwise find can read them as options if they have the same name. # # rolf dot freitag at email.de 2000 for file in $@ do size=`find "$file" -printf "%s"` || continue # overrite all bytes of the file #dd if=/dev/zero of="$file" bs=1 count=$size echo "zeroing file $file: size $size" ddrescue -v --max-size=$size /dev/zero "$file" # set size to 0; see also "Unix Power Tools" # > "$file" # remove # rm -v "$file" done exit 0