Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 360
  • Last Modified:

KDE service menu

I have partaly created a service menu. It calls up shred for me whenever I right click on a file or folder. The problem is shred is very limited and will not shred files contained within sub-folders when the command is issued. I use to issue the command from a command prompt "find /home/AD/Desktop/Trash/joe2 -iname "*" -exec shred {} -v -f -u -z \;" and this would delete all of the files recursivly in all subfolders. Anyone know how I can call this out in this service menu file to do the same thing. Also maybe someone can help me simplify the install script I created since I stink at scripting : )

here is the install script for the service menu file.
cd /usr/share/apps/konqueror/servicemenus/
rm -f shred_files.desktop
echo shred_files.desktop
echo "[Desktop Entry]" >> shred_files.desktop
echo "Encoding=UTF-8" >> shred_files.desktop
echo "ServiceTypes=all/all" >> shred_files.desktop
echo "Actions=shredfiles;shred-folder-contents" >> shred_files.desktop
echo "X-KDE-Submenu=Shred Files" >> shred_files.desktop
echo "X-KDE-Priority=TopLevel" >> shred_files.desktop
echo "Icon=stop" >> shred_files.desktop
echo "" >> shred_files.desktop
echo "[Desktop Action shredfiles]" >> shred_files.desktop
echo "Name=Shred File(s)" >> shred_files.desktop
echo "Icon=stop" >> shred_files.desktop
echo "Exec=shred -vfuxz %F" >> shred_files.desktop
echo "" >> shred_files.desktop
echo "[Desktop Action shred-folder-contents]" >> shred_files.desktop
echo "Name=Shred Folder(s) Contents" >> shred_files.desktop
echo "Icon=stop" >> shred_files.desktop
echo "Exec=shred -vfuxz" >> shred_files.desktop
  • 3
  • 2
1 Solution
No problem.

1) create a wrapper script that execs your find command.

2) Make the desktop entry/service menu execute your script.

3) Profit ;)

regarding your install script, here's the more conventional way to write a file via a script:

#location depends on distro....

rm -f shred_files.desktop 2> /dev/null

cat > shred_files.desktop << EOF
[Desktop Entry]
X-KDE-Submenu=Shred Files

[Desktop Action shredfiles]
Name=Shred File(s)
Exec=shred -vfuxz %F

[Desktop Action shred-folder-contents]
Name=Shred Folder(s) Contents
Exec=shred -vfuxz

I posted my service menu here

Nice nothing better than a good Unix scripter to get things cleaned up :)

>Make the desktop entry/service menu execute your script
How can I write my script containing my find command to be executed on the folder(s) that gets selected?

Thanks again
Lets create a litle program that does this (I'm a programmer so strictly speaking I should charge you $100 an hour, but since I'm not, I wont debug or even try to run it ;)

-----------8< --------------
# if it's a directory, we first find all the
# files inside (recursively) and shred them,
# then remove the directory recursively
if[ -d $1 ]
  find $1 -type f -exec shred -vfuxz \{\} \;"
  rm -rf $1
else # its a file; just shred it
  shred -vfuxz $1
------------8< -------------

Now, save this somewhere in your $PATH (or forever use the full path to the file) as, say, and make it executable (chmod u+x

Then make the service menu execute this script, as in :

.... %F


The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

illtbaguAuthor Commented:
You make me sick : )

I don't understand the -d or the \{\} \;"

$1 == first argument to program

-d == "is the following a directory"

\{\} \; the backslashes are there so find can see them; otherwise bash eats up the special characters and bash will complain.

The extra " at the end of that line is a type-o
>The extra " at the end of that line is a type-o
Maybe thats why I couldn't get it to work
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now