Networking

Hardware

Software

Consultation

 
Clear SPAM Folder Weekly  
 

My SPAM folder gets out of hand in a hurry, so here is what I do to keep it under control.

This assumes that all of your spam folders are under a vmail directory, this could be adjusted to suit any base directory.

Move to your /etc/cron.weekly folder, and create a file called clean-spam-folder.sh

cd /etc/cron.weekly
touch clean-spam-folder.sh
chmod guo+x clean-spam-folder.sh

Now add the following to the file you've just created

#!/bin/bash

BASEDIR=/home/vmail

for i in `find $BASEDIR -iname *spam`
do
        echo "Moving to $i";
        cd $i;
        echo "Currently Contains:";
        ls;
        logger -s -t ClearSPAM "Clearing $i with \"rm -rdf ${i}/*\"";
        rm -vrdf ${i}/* | logger -s -t ClearSPAM
        echo; echo;
done

This will also log what is done to your syslog.

Done...

 
 
 
Continue Running A Script After Closing The Terminal  
 

Have you ever wanted to leave a terminal session before your command has finished running.
It's actually quite easy.

"^z" means to press your control button and the "z" button at the same time, it will not function as a pasted command.

^z ← "ctrl-z"
bg
disown %1
exit

This will stop the current command, send it to process in the background, disown it, and then finally close the session...
DONE...

 
 
 
Copy All Files With .mp3 Extension, Retaining Directory Hierarchy  
 

Open up a command line and type:

find ./Music/ -iname '*.mp3' -exec cp -b --parents {} ./New_Music/ \;

All mp3's from ./Music will be copied to ./New_Music including the directories.

 
 
StartPrev12345678910NextEnd

Page 2 of 15