
Clean Backup Files
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
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
16 years ago
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
16 years ago
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
hayjay
16 years ago
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//'\/\/'/'/'}
Report
LMCBoy
16 years ago
Report
hayjay
16 years ago
but i think there must be a problem without the fix but i do not remember what it was
cu
Hajo
Report
LMCBoy
16 years ago
Thanks Micha!
Report
LMCBoy
16 years ago
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!
Report
dschrader
16 years ago
for each in `ls -1 %u/*~`; do mv $each ~/Desktop/Trash/; done
Report
sarahb523
16 years ago
[ -e filename ]&& mv -f filename /mytrash
Report
LMCBoy
16 years ago
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.
Report