Scripting

Script to delete files listed in a file

This is a short one liner bash script to delete files in a file. The script also handles filenames with space in them. $ while read file; do rm “$file”; done < filename.txt To generate a filename.txt file by searching for a specific pattern you can use the following command $ find / -type f […]

Read More
Photo etc

Rotate and rename images according to their EXIF info

This is my short script to rotate and rename image files accoring to date captured based on their EXIF info. You need jhead and exiv2 to run this. These two programs are also available in Windows and only require you to make small changes to work there as well. #!/bin/bash -x echo Rotating JPEG file(s) […]

Read More
Backup

Backup of Zimbra MailBox using zmmailbox

This is a short script I use to backup the Zimbra mailbox content for my users. This has been used on a Zimbra Collaboration Server (ZCS Open Source Edition) 7.2 installation, but should work on earlier versions as well. I use another script to backup the whole Zimbra installation, but that might be another blog […]

Read More
Linux

Rescue a damaged disk using GNU ddrescue

GNU ddrescue (gddrescue) is a linux data recovery tool. It copies data from one file or block device (harddisc, cdrom, etc) to another, trying hard to rescue data in case of read errors. It can also be used as a forensic cloning tool. Installing gddrescue in Ubuntu linux # aptitude install gddrescue The command to […]

Read More
Scripting

Recursively symlinking files

This is a short script I use to symlink all my JPG image files on my file server to a flat folder accessible to my DLNA enabled devices. My files are organized in year folders and under each year there are month folders: -2011 –2011-01 –2011-02 –2011-03 … -2012 –2012-01 I avoid duplicate symlinks by […]

Read More