Clean Backup Files

Dolphin Service Menus

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

0
Become a Fan
5.0

Description:
This servicemenu contains two actions for directories:

"Delete backup files": deletes all files matching *~ in the selected directories.

"Move backup files to Trash": moves all files matching *~ to the Trash
Last changelog:

1.0.2: Don't panic if a directory contains no backup files. Also, put the actions in a submenu. These fixes courtesy of Micha Scholl.

1.0.1: small improvement to install script.

1.0: Initial release


Ratings & Comments

8 Comments

hayjay

There is a little Problem in the way the script generates the installation paths. On some Systems like my suse box the call of kde-config --localprefix may result in a path with appending / so that you will have a // in the complete path the following after the generation of complete paths will fix this: PGLOBAL=${PGLOBAL/'\/\/'/'/'} PLOCAL=${PLOCAL//'\/\/'/'/'} KDIALOG=${KDIALOG//'\/\/'/'/'}

LMCBoy

Thanks for the fix. Isn't it true that a double // in a path is harmless, though?

hayjay

it seems that you are right but i think there must be a problem without the fix but i do not remember what it was cu Hajo

LMCBoy

Please download 1.0.2. Thanks to Micha Scholl, it will no longer complain when the target directory doesn't contain backup files. Thanks Micha!

LMCBoy

Hello, I'm the author of cleanbak. Please be aware that if you try to move backup files to Trash on a directory in which there are no backup files, you'll get some bizarre error message about the mv command not being recognized. I believe this error message appears because mv throws an error if the source file does not exist. I need to avoid or suppress this error, so that konqueror doesn't panic. So, I have been trying for a few hours to write an Exec command using bash to check whether backup files exist before trying to move them, but I have not been successful. Here is my latest unsuccessful attempt: Exec=/bin/sh -c 'path=%u; t=$path/*~; if [ $t != "$path/*~" ]; then mv -f $path/*~ ~/Desktop/Trash 2>/dev/null; fi' So, if backup files exist, then t is a space-separated list of the backup files. If no backup files exist, then t is assigned the literal string "$path/*~" (with $path expanded). That's why I only execute the mv command if $t != "$path/*~". It's an ugly kludge, but it does work in a test shell script I wrote. It just doesn't work in the cleanbak.desktop file: the mv command is never attempted, whether backup files exist or not. If anyone has advice or ideas on how to make it work properly, please let me know!

dschrader

What about something like: for each in `ls -1 %u/*~`; do mv $each ~/Desktop/Trash/; done

sarahb523

you can use something like that: [ -e filename ]&& mv -f filename /mytrash

LMCBoy

No, this does not work if the target directory contains more than one backup file. If I do something like: if [ -e %u/*~ ]; then mv -f %u/*~ ~/Desktop/Trash; fi as you are suggesting, then the "*" is expanded to a space-separated list of all the matching files in the directory. -e expects only one argument, so the command fails. That's why I was trying the more convoluted statement I originally posted.

Pling
0 Affiliates
Details
license
version 1.0.2
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 0

Other Dolphin Service Menus:

burnWithGrowisofs
chunkylover
last update date: 20 years ago

Score 5.0

Firefox-bookmarks service menu
storyteller
last update date: 20 years ago

Score 5.0

Text Convert Service Menu
smp-penguin
last update date: 21 years ago

Score 5.0

Pdflatex servicemenu
bobuse
last update date: 19 years ago

Score 5.0

Send through Bluetooth
dmnet
last update date: 20 years ago

Score 5.0

Add to Bloglines
spookster
last update date: 20 years ago

Score 5.0



System Tags