Bits of Perl
When I find myself needing to automate a repetitive task, I'll often choose to whip up a Perl script to get the job done efficiently. These scripts are customized to work for my specific tasks.
Photo Backup
It's a good idea to create regular backups, and this script automates that. It detects which photos haven't yet been backed up and copies them over to the backup destination. If a disk is full, you can swap disks and pick up where it left off.
Source: backup_usual.pl
Update File Creation Time
I keep all my photos organized by the day and event. They are stored in the format "YYYY-MM-DD Event Name". This script uses the folder's name to modifiy the mtime of the photos within it.
My photo application, KPhotoAlbum, gets photo dates from the creation time if no exif info is available, and since the dates on some of my older photos were skewed, this set my photos up such that KPhotoAlbum would retrieve all the correct dates.
Source: update_time.pl
List Referenced Files in HTML
I use this script to tell me all files that are referenced by a particular HTML file. It is used to create zips of my websites. In the shell I run:
$ zip site.zip site/*.html `ls_files.pl site/*.html`
and only files actually used in the site will be included in the output. Temporary files and files used to generate content will still exist for my use but won't be included for distribution of the site.
Source: ls_files.pl
