I want a command to shred completely the contents of a folder/directory (which may be inside folders/directories). Also please explain the command.
I want a command to shred completely the contents of a folder/directory (which may be inside folders/directories). Also please explain the command.
secure-delete
.srm -r pathname
to remove your folder and files.The default settings are for 38 (!!!) passes of overwrites which is extreme overkill imho (see more info about this here).
For my usage, I only want a single pass of random data so I use
srm -rfll pathname
.If you want to create a right-click option in the GUI for files and folders, use gnome-actions to call a script like this:
If you want more paranoid settings be sure to modify the above script.
For files not directories, here's a more simple way instead of
-exec shred -u {} \;
type of way:then
this does 48 passes recursively to the current directory you
cd
'ed into.Hope this helps some.
sudo apt install wipe
$ wipe -rfi dir/*
where the flags used:
-r – tells wipe to recurse into subdirectories -f – enables forced deletion and disable confirmation query -i – shows progress of deletion process
Shred works only on files. You need to shred the files in the dir/subdirs first and then remove the directories. try
and make sure you only see the files you want to delete
then remove the dirs with
You probably want to use something similar to this:
First command finds only files and passes them to shred (as many at once as possible - no need to start a new shred process for every file like \; does). Finally, remove the directories too.
I have inserted the following bash script for this purpose in my .bashrc
If you want to do this from Nautilus (aka 'Files' app), then you could use the nautilus-wipe package.
sudo apt-get install nautilus-wipe
Once installed, there will be two new options when you right-click on a folder:
Wipe
andWipe available disk space
. ChoosingWipe
on the folder will give further options (e.g. number of passes, fast mode, last pass with zeros).When I need to shred multiple files or an entire directory I simply use
shred -vzn 20 ./shredme/*.*
for example, which overwrites all files with any file extension in the "shredme" folder. Then you can use the standard rm -rf ./shredme command to remove the folder itself (or just right click and delete the folder) as all the data has been overwritten 20 times for this example.I did a quick example of this with a bunch of duplicate images as an example.