Batch renaming files
March 10, 2005 7:31 PM   Subscribe

I'm looking for a good way to tweak bunches of files. I'm pretty sure there's been a question about this before, and "Batch Rename" was recommended. Looking for other recommendations, or advice on Batch Rename.

I need a batch renamer with regular-expression-like features. At minimum, it should easily trim out and clean up file names:
4-593_file_uber_name-211505
to
file uber name - 211505

Ideally it could shift parts of the filename around:
4-593_file_uber_name-211505
to
file 211505 - uber-name

I downloaded Batch Rename, and it looks like it does some of what I want... but there are no help files at all, and no documentation that I can find on the web. A few of its features are completely non-obvious to me, and a few don't work like they seem they should.
So: Is there a better program? Or documentation?
Thanks!
posted by agropyron to Computers & Internet (9 answers total)
 
Best answer: I've used Flexible Renamer for this kind of thing in the past. It's got a bare-metal regular expression mode that will do this kind of thing easily -- if you know regular expressions. Just set up the matching pattern with parenthesized groups, and then reference back to them with /1, /2, etc.
posted by smackfu at 7:42 PM on March 10, 2005


Response by poster: Looks great. This could spell doom for me, as I descend into an obsessive-compulsive spiral of file renaming. :)
posted by agropyron at 8:08 PM on March 10, 2005


This could easily be done with perl if you have it installed on your linux box or pc. ;)
posted by SpecialK at 8:11 PM on March 10, 2005


Best answer: Also check out 1-4a rename (which is in dire need of a rename itself). It can do substring switcheroos and the site has extensive use cases.
posted by turbodog at 8:28 PM on March 10, 2005 [1 favorite]


I second 1-4a rename, i've been using it for quite some time.
posted by escher at 9:21 PM on March 10, 2005


I guess DOS is dead.
posted by caddis at 6:29 AM on March 11, 2005


Bulk Rename is another nice utility. The best feature is the preview pane that shows what the directory will look like after your rename or regex gets applied. Saved me a few awful mistakes.
posted by yerfatma at 7:40 AM on March 11, 2005


I love "Total Commander" which can do this and much more.

http://www.ghisler.com/

# Two file windows side by side
# Multiple language support
# Enhanced search function
# Compare files / synchronize directories
# Quick View panel with bitmap display
# ZIP, ARJ, LZH, RAR, UC2, TAR, GZ, CAB, ACE archive handling + plugins
# Built-in FTP client with FXP (server to server) and HTTP proxy support
# Parallel port link, multi-rename tool
# Tabbed interface, regular expressions, history+favorites buttons
# Thumbnails view, custom columns, enhanced search
posted by denishowe at 8:44 AM on March 11, 2005


I use the following script (thanks to the unknown author). perlexpr in the usage means something like 's/changethis/tothis/' -- so 'rename s/1/2/ class*' would rename class1.cpp and class1.h to class2.cpp and class2.h.


#!/usr/local/bin/perl5.8 -w
use strict;

# usage: rename perlexpr [files]

(my $regexp = shift @ARGV) or die "usage: rename perlexpr [filenames]\n";

if (!@ARGV) {
@ARGV=;
chomp(@ARGV);
}

foreach $_ (@ARGV) {
my $old_name = $_;
eval $regexp;
die $@ if $@;
rename($old_name, $_) unless $old_name eq $_;
}

exit(0);

posted by harmfulray at 10:04 AM on March 11, 2005


« Older How do I catch a newspaper thief?   |   How does a magazine interview work? Newer »
This thread is closed to new comments.