Program for batch renaming of files...

Discussion in 'PC Hardware, Software and Displays' started by zsouthboy, Jun 29, 2005.

  1. zsouthboy

    Regular

    Joined:
    Aug 1, 2003
    Messages:
    563
    Likes Received:
    9
    Location:
    Derry, NH
    I have about 1000 different files that need to have their filenames truncated at the first space... (e.g. "123-TH-098 Product Name.txt" needs to become "123-TH-098.txt")

    I've tried Useful File Utilities (and looked for plugins to do this for me too), and it doesn't provide this functionality.

    Anyone know of a program that'll do this for me?

    In reality, I can whip up something in C++ that'll do this for me, but time is of the essence, so if there's already a program available, I'd like to use that.


    Suggestions?
     
  2. Frank

    Frank Certified not a majority
    Veteran

    Joined:
    Sep 21, 2003
    Messages:
    3,187
    Likes Received:
    59
    Location:
    Sittard, the Netherlands
  3. zsouthboy

    Regular

    Joined:
    Aug 1, 2003
    Messages:
    563
    Likes Received:
    9
    Location:
    Derry, NH
    Okay I'm running into the same problem with this as I did with Useful File Utilities:

    The number of digits of the catalog number is not constant. Therefore, trying to keep the first 7 characters from the filename won't work. Hence I specifically need to truncate at the first space....

    Good program though, I'll keep it around for other things...
     
  4. carpediem

    Regular

    Joined:
    Apr 4, 2004
    Messages:
    351
    Likes Received:
    7
    Location:
    Sweden
  5. [maven]

    Regular

    Joined:
    Apr 3, 2003
    Messages:
    645
    Likes Received:
    16
    Location:
    DE
    Total Commander (Windows)
    Automator (Mac)
     
  6. Blazkowicz

    Legend Veteran

    Joined:
    Dec 24, 2004
    Messages:
    5,607
    Likes Received:
    256
    perl/python/whatever script? (I don't know these languages :))
     
  7. zsouthboy

    Regular

    Joined:
    Aug 1, 2003
    Messages:
    563
    Likes Received:
    9
    Location:
    Derry, NH
    Okay i'm doing it using a combination of AF5 Rename your Files and THE Rename...

    I'm using the "separate words" option of THE Rename to push the first space over far enough so that I can truncate to the furthest character that i want to keep. Then I use AF5 to actually do the truncation. Then I use THE Rename to "remove internal spaces". Works much better than doing it by hand.

    Thanks guys! :)
     
  8. Frank

    Frank Certified not a majority
    Veteran

    Joined:
    Sep 21, 2003
    Messages:
    3,187
    Likes Received:
    59
    Location:
    Sittard, the Netherlands
    Ah, I just made you a proggie that does what you want:

    I called it renx.

    But I guess I was too slow :D
     
  9. zsouthboy

    Regular

    Joined:
    Aug 1, 2003
    Messages:
    563
    Likes Received:
    9
    Location:
    Derry, NH

    Holy crap that works awesome!

    Thanks so much, I hadn't done it yet, this'll work great!

    You have my eternal gratitude.

    :)
     
  10. suryad

    Veteran

    Joined:
    Aug 20, 2004
    Messages:
    2,479
    Likes Received:
    16
    Wow DiGuru...interesting stuff...I gotta try it out as well!
     
  11. Basic

    Regular

    Joined:
    Feb 8, 2002
    Messages:
    846
    Likes Received:
    13
    Location:
    Linköping, Sweden
    OK, I know I'm two weeks late here, but I just had to pop in. :D

    A real geek would start up his xterminal (or cygwin if he's in windows), and write something like:
    Code:
    du -a | awk '{match($0,"([0-9]+[ \t]+)(.[-_./ [:alnum:]]*/[-_.[:alnum:]]+)( [-_. [:alnum:]]*)([.][[:alnum:]]*)",a); if(a[0]) system("mv \""a[2] a[3] a[4]"\" \"" a[2] a[4]"\"")}'
    And then pray to god that he typed it right. :? :D
    (I haven't tested it, so I don't take any responsibility for any files lost.)
     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...