Perl Hacks

[Home] [Linux Kernel] [emacs] [Projects] [Hacks]


Snapshots of all the latest versions of my scripts can be found here. You can also browse my perl CVS tree and see what else I've put there.
Script Description
dupmerge A script for merging partial duplicate files
catalog A script for sorting through media files
rpmclean A script for cleaning up .rpmnew files
naut-jpeg A Nautilus helper script for rotating JPEG's

dupmerge

I use this script to tidy up my gtk-gnutella download directories. I find a lot of files come under many different names and most don't complete downloads. However gtk-gnutella supports resume so the mode I most often use it in is merge. Example: When gtk-gnutella is not running:

dupmerge.pl --action=merge ~/Downloads/gtk-gnutella/downloading/

Which will result in all partials of the same file (whatever the name) having the most complete version of the file copied over them. Please note these are not symlinks so you better have spare disk space if your downloading big files.

Once I've had a succesful download I can clean out all the old partials using the recursive feature (as my completed downloads live in ~/Downloads/gtk-gnutella/downloaded) by doing:

dupmerge.pl -r --action=delete ~/Downloads/gtk-gnutella/

By default if no action is specified dupmerge will just list potential duplicates. Calling with --help will list the current options. This was the first perl script I wrote so forgive any cruft but patches and/or suggestions welcome.

catalog

This script is written to help speed up sorting through all the stuff I download via gtk-gnutella. The basic form is:

catalog.pl ~/Downloads

At which point it will play each movie (with mplayer) in the ~/Downloads directory and when finished you can press a single key to file it into a subdirectory.

The script has a few built in targets If your sorting mp3's or ogg's or you can specify your viewer using the "--cmd=" argument.

If like me you store all your files on a separate server or mounted drive you can specify a target top level directory to move stuff to, e.g.

catalog.pl --dst=/mnt/media --cmd=ogg123 ~/Downloads/