Jump to content
Sign in to follow this  

Any shell scripters in the house?

Recommended Posts

I have a collection of files which was (naively) assumed never to need more than a certain number of samples per category. Naturally, this has exploded in a cataclysm of filename collisions.


Rather than tediously renaming all these things by hand, I'd like to be able to do something like:

ren *##.* *_000##.*
Where * is any sequence of characters, and # is a digit. Still going to explode one day, but it's 1000 times as far away - by which time I'll be dead and it's SEP. ;)


Naturally, CMD does not have any such ability - it can't discriminate between alphas and numerics, nor will it allow me to be quite so cavalier about mixing pre- and post-fix substitutions. I thought about using PowerShell to do it, but I can't make head or tail of the abortion MS calls documentation.


Anyone got any clues for me? Please?

Share this post

Link to post
Share on other sites

IrfanView (image viewer) has a batch rename facility, no idea if it'll cater for your needs or if in fact it will process non-image filenames. I suspect AcdSee might also have one.


But yeah, aside from that my next suggestion would have been something like PowerShell, Perl or similar.

Actually, in modern Windows versions there's a little trick that lets you do it from an Explorer window. It mightn't suit your needs straight up but could serve as an intermediate step, then use a CMD window to further tailor the results.



Share this post

Link to post
Share on other sites





Have it; inapplicable (they are images ;) and unfortunately it won't do what I want.

Don't have it, but I'll give it a look.


The Explorer trick I know, and that won't touch it either, sorry.



PowerShell, Perl or similar.

/nod. Figures. Next stop: using pattern-matching is PS. Seriously, what monkey did they get to write those pages? Accurate, yes - useful, no.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this