Jump to content


Photo

Any shell scripters in the house?


Best Answer Cybes, 28 January 2016 - 11:49 PM

http://www.bulkrenam.../Main_Intro.php


Excellent! Well, not 100%, but with some brief head scratching I managed to get all but a handful of them automagically converted. Go to the full post


  • Please log in to reply
5 replies to this topic

#1 Cybes

Cybes

    Titan

  • Atomican
  • 17,679 posts
  • Location:Where I am

Posted 27 January 2016 - 03:09 PM

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?

"Reality does not care what you think." - Dr Richard Feynman
"Ideas do not deserve respect.- people do." - Peter Boghossian (paraphrase)


#2 Rybags

Rybags

    Immortal

  • Super Hero
  • 34,396 posts

Posted 27 January 2016 - 03:23 PM

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.

 

http://www.howtogeek...multiple-files/



#3 Cybes

Cybes

    Titan

  • Atomican
  • 17,679 posts
  • Location:Where I am

Posted 27 January 2016 - 04:46 PM

IrfanView...
AcdSee...

Explorer...

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.

"Reality does not care what you think." - Dr Richard Feynman
"Ideas do not deserve respect.- people do." - Peter Boghossian (paraphrase)


#4 rs727

rs727

    Master

  • Atomican
  • 605 posts

Posted 27 January 2016 - 09:45 PM

http://www.bulkrenam.../Main_Intro.php

 

Has a huge number of options, so I wouldn't be surprised if it can do what you want.



#5 Cybes

Cybes

    Titan

  • Atomican
  • 17,679 posts
  • Location:Where I am

Posted 28 January 2016 - 02:26 AM

http://www.bulkrenam.../Main_Intro.php
 
Has a huge number of options, so I wouldn't be surprised if it can do what you want.


Looks promising - I'll play with that on the morrow. Thanks, RS!

"Reality does not care what you think." - Dr Richard Feynman
"Ideas do not deserve respect.- people do." - Peter Boghossian (paraphrase)


#6 Cybes

Cybes

    Titan

  • Atomican
  • 17,679 posts
  • Location:Where I am

Posted 28 January 2016 - 11:49 PM   Best Answer

http://www.bulkrenam.../Main_Intro.php


Excellent! Well, not 100%, but with some brief head scratching I managed to get all but a handful of them automagically converted.

"Reality does not care what you think." - Dr Richard Feynman
"Ideas do not deserve respect.- people do." - Peter Boghossian (paraphrase)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users