Image 01
profile-image

warsev

Warren Severin Phoenix, United States of America
shred_file

Nautilus Scripts by sp00k113 13 comments

Small revision to display just file basenames, not full paths.
[code]
#!/usr/bin/env bash
nfiles="$#"
files=""
for file in "$@" ; do
if [ ${#files} -gt 0 ] ; then files="$files\n"; fi
files=$files$(basename "$file")
done
zenity --question --title="shred these $nfiles files - REALLY??" --text="$files"
if [ "$?" = 1 ] ; then
exit $?
else
nfile=0
(for file in "$@" ; do
echo \# shredding $(basename "$file")...
shredout=$(shred -u -z -n 1 "$file" 2>&1)
rc=$?
if [ $rc -ne 0 ] ; then
echo "100"
zenity --error --title="No break for you today" --text="$shredout"
exit $rc
else
let nfile++
echo $((nfile * 100 / nfiles))
fi
done ) | zenity --progress --title="Wiping files..." --auto-close \
--percentage=0 --text="starting..." --no-cancel
fi
exit 0
[/code] - Feb 25 2011
shred_file

Nautilus Scripts by sp00k113 13 comments

This version will display a confirmation dialog; it can handle file paths with spaces in them; it catches and displays stderr from shred; and it displays a zenity progress bar. Use at your own risk, of course.
[code]
#!/usr/bin/env bash
nfiles="$#"
files=""
for file in "$@" ; do
if [ ${#files} -gt 0 ] ; then files="$files\n"; fi
files="$files$file"
done
zenity --question --title="shred these $nfiles files - REALLY??" --text="$files"
if [ "$?" = 1 ] ; then
exit $?
else
nfile=0
(for file in "$@" ; do
echo "# shredding $file..."
shredout=$(shred -u -z -n 1 "$file" 2>&1)
rc=$?
if [ $rc -ne 0 ] ; then
echo "100"
zenity --error --title="No break for you today" --text="$shredout"
exit $rc
else
let nfile++
echo $((nfile * 100 / nfiles))
fi
done ) | zenity --progress --title="Wiping files..." --auto-close \
--percentage=0 --text="starting..." --no-cancel
fi
exit 0
[/code] - Feb 25 2011