Tool of the Month: Fetch Yahoo and renameutils
October 2004
by Joe "Zonker" Brockmeier

This month, I'll cover two of my new favorite utilities. The first is a utility for retrieving mail from a popular webmail service, and the other is a handy shell utility that every admin and "power user" will find extremely useful.


Many folks I know have one (or more) of the freebie Yahoo! Mail accounts. Yahoo!'s webmail interface is pretty decent, and it's great to have a webmail account when you're on the road or for other purposes but for day-to-day usage, most of us have a preferred mail client like Mutt, Pine, Thunderbird, Mozilla Mail, Evolution, KMail, or any number of other mail clients. Having to log into Yahoo! to read email is sometimes a bit of a pain, and it's much nicer to be able to aggregate all of your mail for long-term storage rather than having saved messages in different places.

That's why I really like FetchYahoo. It's a Perl script that you can use to download mail from your Yahoo! Mail account, and (if you want to) forward mail to another account. To get started, head to http://fetchyahoo.sourceforge.net/ and grab the latest version.

Note that you will need a few Perl modules to utilize the script. Specifically, you'll need HTML::Entities, LWP::UserAgent, MIME::Entity, Net::SMTP, and Crypt::SSLeay.

To set up fetchyahoo, grab the script from the Web site and open it up in your favorite editor. It's well-commented, so it should be fairly obvious what you need to change. Alternately (the method I prefer), you can create a ~/.fetchyahoorc configuration file that will contain your account information and configuration preferences.

Note that you need to be a bit careful when setting this up the first time I managed to delete the first 100 messages from my Yahoo! inbox without actually downloading them or forwarding them the first time I used this utility. Lucky for me, I don't actually keep anything vital in my Yahoo! account.

You have a few options: you can download your messages to your local machine, output messages to an IMAP mailbox, or forward the messages to another address. I opt to forward my messages to my spiffy new Gmail account, which is fast becoming my favorite method of email.

Once you have your configuration set up, just run the fetchyahoo script and it will log into Yahoo for you, check your messages, and direct them accordingly. Note that you can also use this utility with different folders in your account. For example, you could set it up to clean out your Yahoo! Mail bulk folder periodically rather than checking your inbox.

For Hotmail users, there's the Gotmail utility. Since I don't have a Hotmail account, I can't say whether this utility is still up-to-date or how well it works. If you do use Hotmail, though, check it out and let me know whether you find it useful.


I've written about file-renaming utilities before, but the tools that make up renameutils are my current favorites.

Head to the renameutils homepage to grab the latest version. The author has put up a source tarball and an RPM. I grabbed the source and had it installed in about two minutes.

First, let's look at the "quick move" utility, qmv. When you run qmv by itself, it will open up your favorite editor with all of the filenames in the current directory in two columns. If you want to change filenames, edit the filenames in the second column, and when you save and exit, qmv will then change the filenames for you. This makes it very easy to change names in batches.

Starting qmv in the interactive mode (qmv -i) will allow you to edit filenames and see the changes before they're applied. When you start in interactive mode, you'll see a prompt that looks like this:


To get the list of possible options, type "help" and qmv will give you the possible options to use in interactive mode. To edit filenames in the current directory, run "edit" and Mqmv will open the dual-column list of filenames in your default editor. Note that if you have no EDITOR environment variable set, qmv will be pretty useless. You either need to set the environment variable (export EDITOR=vim, for example) or specify your editor with the -e option.

Once you've edited the filenames, save and exit. This will return you to the qmv prompt and you can now run "plan" to see what changes will be made. If you like the changes, run "apply." If not, run "edit" again or just run "quit" and no changes will be made. A little practice with this utility and you'll be batch-renaming files by the hundreds in no time.

Next up is imv. If you're like me, you probably find it annoying to retype a long filename to make a simple change. Let's say, for example, you want to move "longfilename.tar.gz" to "longfilename.old.tar.gz." You could use qmv, but that's overkill. The imv utility will allow you to make a change to just one filename. Run imv filename and you'll see a prompt with the filename you want to change. Edit the filename, press enter, and the change will be made. Easy as pie.

Finally, there's the deurlrename utility. This one simply removes URL-encoded characters (like the annoying "%20" that replaces a space in a filename) when you've downloaded a file and it still has the URL remnants in the filename. This is particularly useful with (legally!) downloaded MP3s and so forth.

Those three utilities can help save a lot of time. Be sure to download renameutils and take them for a spin.


That's all for this month. As always, I'm open to suggestions for future columns. In particular, I'd like to know of any utilities like fetchyahoo for Gmail. Of course, any other utilities would be interesting as well. Just drop me a note with "Tool suggestion" in the subject line. Thanks much to all the folks who have sent in suggestions so far. Until next month, have fun with fetchyahoo and the renameutils!

Copyright 2004 CMP Media LLC, Privacy Policy

Questions or problems regarding this web site should be directed to abeckman@outdoorssite.com.

Copyright 2008 Art Beckman. All rights reserved.

Last Modified: March 9, 2008