Script bash - KDE_CLEANER v20151026

Logo Bash

This script is in alpha phase, it was created with the purpose of deleting all temp files and another stuff.

KDE Cleaner v20151026
#!/bin/bash
####################################################################
# Author: Delio Docampo Cordeiro                                   #
# Version: 20151026                                                #
# Description: This script cleans thumbnails, caches, temp files   #
#              and another history files used in KDE.              #
####################################################################
echo -e "\nInfo: This script uses secure-delete package for 'srm' command."
echo -e "\nDelete temp and history files from $USER ? [y/N]"
read YNO

MESSAGE+=("does not exist");
MESSAGE+=("Execution aborted");

case $YNO in
    "y"|"Y")
        DIRECTORY+=("/home/$USER/.thumbnails")
        DIRECTORY+=("/home/$USER/.adobe/Flash_Player")
        DIRECTORY+=("/home/$USER/.macromedia")
        DIRECTORY+=("/home/$USER/.cache/thumbnails")
        DIRECTORY+=("/home/$USER/.cache/mozilla")
        DIRECTORY+=("/home/$USER/.cache/thunderbird")

        function secure_delete {
            find "$1" -type f -exec shred -zuv -n 30 {} \;
            srm -vr "$1"
        }
        for DIR in "${DIRECTORY[@]}"; do
            if [ -d $DIR ]; then
                secure_delete $DIR
            else
                echo -e "The directory \"$DIR\" ${MESSAGE[0]} "
            fi
        done
    ;;
    *)
        echo "${MESSAGE[1]}"
    ;;
esac

Don’t use this code for comercial porpouses, and be careful to run it, i don’t guarantee this code for another person than me ;)