Usenet File Renamer

If you download files using Usenet, and use an indexing service such as newzbin, you probably end up with a bunch of folders for each download which have the message id's prepended to them (for example, 'msgid_2506856_Abdominal_-_Escape_from_the_Pigeon_Hole_(2007)'). It's annoying, but here's a little Perl script which'll rename the folders for you with a fully cleaned up name:

#!/usr/local/bin/perl
opendir(DIRHANDLE, ".") || die "Cannot opendir directory: $!";
foreach $folder (sort readdir(DIRHANDLE))
{
	if($folder =~ m/msgid_(d+)_(.+)/)
	{
		$new_folder = $2;
		$new_folder =~ s/_/ /g;

		rename($folder, $new_folder);
		print "Renaming folder: $new_folder";
	}
}
closedir(DIRHANDLE);

It'll take the above example and rename it to 'Abdominal - Escape From the Pigeon Hole (2007)' - much better. Feel free to download the usenet renamer, adapt it, and redistribute it!

This post is related to 1 areas of discussion: .

Allowed tags: <a>, <strong>, <em>




please enter the text below.

If you can't read the word, click here

There are currently no comments on this post - why not add one?

ss_blog_claim=398d1cbe94ffdef199ef8cd616fd31bb