Shred file Entry in PcManFm?

The dedicated forum for PCMan File Manager - http://wiki.lxde.org/en/PCManFM
Locked
lxdeISready4granny
Posts: 3
Joined: Thu Mar 04, 2010 10:45 pm

Shred file Entry in PcManFm?

Post by lxdeISready4granny »

I was wondering what hoops one might jump through in order to get a 'Shred File' menu entry in the PcManFM right click menu. If it invovles downloading and editing source files, I would not be opposed to that. I would really like the entry to execute 'shred -u' on whatever file or folder one right clicks on. I am using PcManFM version .5 on Debian Lenny, if that helps. Any ideas?
IgnorantGuru
Posts: 30
Joined: Sat Feb 27, 2010 7:35 pm
Contact:

Re: Shred file Entry in PcManFm?

Post by IgnorantGuru »

My mod allows you to add arbitrary commands to the right-click menu...
http://igurublog.wordpress.com/downloads/mod-pcmanfm/

Run ./installmod to install it as "pcmanfm-mod". Then in your case you could edit /usr/share/applications/pcmanfm-user-f6.desktop:

Code: Select all

[Desktop Entry]
Name=Shred
Exec=shred -u
However, that will shred all selected files when you press F6 or select Shred from the right-click menu. I would recommend adding in a "Are you sure?" dialog. Also, if you want to shred folders as well as files, shred won't work. I recommend using srm from the secure-delete package instead.

First install

Code: Select all

apt-get install secure-delete zenity
Then edit /usr/share/applications/pcmanfm-user-f6.desktop to run your script:

Code: Select all

[Desktop Entry]
Name=Shred
Exec=/opt/scripts/myshred
Then as root save this script as "/opt/scripts/myshred" (or wherever):

Code: Select all

#!/bin/bash

if [ "$1" = "" ]; then
	exit
fi

zenity --question --text "Shred all selected files and folders?"
if [ $? = 0 ]; then
	while [ "$1" != "" ]; do
		srm -r -ll "$1"
		shift
	done
fi

And make it executable:

Code: Select all

chmod ugo+x /opt/scripts/myshred
Zenity guide...
http://linux.byexamples.com/archives/26 ... xamples-2/

Or, if you want to hard code it, have a look in ptk-file-menu.c
Check out my blog for useful scripts, mods and tips... http://igurublog.wordpress.com
Locked