Linux

Rename file extension recursively

This is a simple bash script to rename all JPG file extensions to JPEG, it works recursively and takes subfolders also. #!/bin/bash function rename_extension { #change all .jpg to .jpeg for file in $1/*.jpg; do mv $file $1/`basename $file .jpg`.jpeg; echo $file; done; # recurse directories for d in $1/*; do if test -d $d; […]

Read More
Scripting

Send e-mail with attachment from command line

mpack is a command line tool that can send e-mail with MIME formatted attachment. mpack -a -s “My subject From: Sender<from@example.com>” -d messagebody.txt attachment.file recipient@example.com Since mpack accepts linebreaks in the -s option (which is actually ment to set the subject line) we can include other headers right after it. Just like I did in […]

Read More
Scripting

Problem sending e-mail from console

After installing Zimbra 5.0.x on my Debian Etch 4.0 server some of my shell scripts couldnæt send mail anymore. The reason to this behaviour was that I hadn’t removed the Exim mail server package, and I wouldnt do it either. The solution to this problem was to remove exim or locate the sendmail binaries and remove […]

Read More