
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
------------------------------------------------------------------------------
***CAUTION***
Do NOT use on device files like /dev/hda.
If you need to shred these files, refer to the shred man pages.
***CAUTION***
Use of this script on a file will make recovery impossible,
even with the more expensive file recovery solutions.
This script will shred the input file, after confirmation.
You will also be notified, when shredding is complete. (Should this be
removed?)
Depends
-------
*Obviously you need to have the shred utility installed and in your $PATH.
Since there are some misconceptions/worries about the shred utility regarding ext3, I will put it simple:
If your /etc/fstab file contains an entry for an ext3 partition, and that entry uses 'data=journal',
then the shredded file can still be recovered. If your /etc/fstab file contains an entry for an ext3
partition, and that entry uses 'data=ordered' or 'data=writeback', then your file is gone for good.
*This script also makes use of zenity (http://freshmeat.net/projects/zenity)
This also works well as a Nautilus Action. See the included screenshot for my example configuration.
See README for more info
9 years ago
1.0:
20111205
Complete rewrite by warserv. Wanna take this over? Email me.
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.
0.2:
20100402
Updated to support shredding multiple files. Thanks jbom.
0.1:
20070907 Script release
9 years ago
1.0:
20111205
Complete rewrite by warserv. Wanna take this over? Email me.
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.
0.2:
20100402
Updated to support shredding multiple files. Thanks jbom.
0.1:
20070907 Script release
warsev
9 years ago
[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]
Report
warsev
9 years ago
[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]
Report
sp00k113
9 years ago
I don't really want to maintain this anymore. Anyone want it?
Report
D4v3
9 years ago
Report
hellboy17291
11 years ago
Report
sp00k113
10 years ago
Report
luciferax
11 years ago
Thanks in advance.
Report
jbom
11 years ago
This is the first response I have made on any forum and the first time I have put any code up (glad to do it finally) so excuse me if I don't do this right.
Thanks for the original script, it opened my eyes.
I modified it slightly so it handles multiple files and sets the number of passes to 1 (I was using it on a sd card). I think 1 pass for most media is good enough for normal people, you can change it by modifying or removing the -n 1 argument to shred. Seems to work ok.
files="$@"
zenity --question --title="Shred" --text="Are you sure you wish to shred $# files: $files?"
if [ "$?" = 1 ] ; then
exit $?
else
shred -u -z -n 1 $files
zenity --info --text="$# files shredded: $files."
fi
Report
sp00k113
10 years ago
Report
OmegaTree
13 years ago
Unfortunately I can't get it to work. I set up up, rightclick, shred, and it says "are you sure?", and I click yes. It says its done and accomplished but the file is still there. However I'm using XFS (whoot!) but I guess that's causing trouble. I have zenity but it still ain't working. I hope this has been any bit helpful and I hope that it can be made to work for all FS's.
Report
sp00k113
13 years ago
Report
OmegaTree
13 years ago
Report
Rafterman
13 years ago
That should help shed some light as to what's going on. You should have zenity though if you say you got a dialog box after starting the script. Do "whereis zenity" to find out for sure.
Report