[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RFS: patmv -- a bulk renaming tool



I'd like to request a sponsor for my "patmv" package.  patmv is a Perl
script that can be used to do bulk renames on files based on a Perl
expression ("pattern").  I've been using this script for about 10
years, and it has a small following among current and former
co-workers.  The idea was inspired by a short example that was
included with perl 5.000 or one of its betas, but my script is an
expansion on the original concept.

You can retrieve the package from mentors.debian.net.  They are
lintian and linda clean and they build in pbuilder.  I have read the
policy, social, contract, etc. and have had my key signed by Debian
developers.  I've also completed more substantive and complex
packaging tasks and have read Matthew Palmer's sponsorship FAQ at
http://people.debian.org/~mpalmer/sponsorship.html.  I have not
created an ITP though since, prior to this weekend, this script was
not packaged and pretty much only existed on machines that I could log
into.

The patmv program is most useful to people who have to deal with
sanitizing names on large groups of files.  It's one of our must-have
tools when dealing with receipt of batches of data from our clients.
It helps to have some Perl knowledge, but anyone who can use sed can
use patmv, and the manual page gives plenty of examples that people
can modify.

The idea is simple: patmv takes an expression that operates on $_ as a
command-line argument.  For each file, it evals the expression with
the last component or whole filename (depending on options) set to
$_.  If the operation changes the name, a rename is done.  patmv is
intelligent about keeping track of intermediate steps, making it safe
to use in cases where directories get renamed before their contents.
It can take lists of file names on the command line or read them from
stdin, one file per line.

Here are a few quick examples:

To change all spaces to underscores recursively in "Some Directory":

find "Some Directory" -print | patmv 's/ /_/g'

To change the names of all the files in the current directory to lower
case:

patmv tr/A-Z/a-z/ *

To forcibly overwrite all files named whatever with any files named
whatever.new:

patmv -f 's/\.new$//' *.new

and so forth.

The version I uploaded is version 1.0.  Although the code is very
thoroughly tested (both by the included automated test suite and by
years of daily use), this is the first time I've made a public
release.

I'd be eager for your consideration and any comments.

Oh, one note: there are no differences at all between the upstream
version and the Debian version: the debian files (and an rpm .spec
file) are both included in the upstream sources.  Based on a
discussion on debian-devel, however, I've decided to not package this
as native.  Therefore, there is a .orig.tar.gz and a .diff.gz, even
though the .diff.gz is empty (well, actually the result of running
gzip on an empty file), and the Debian revision is 1.  I thought I'd
mention this so that it was clear that I did it this way on purpose.

-- 
Jay Berkenbilt <ejb@ql.org>
http://www.ql.org/q/



Reply to: