CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    Dec 2012
    Posts
    3

    Batch rename tool or app?

    Hi all - first post here. I had no idea where to put this, so I figured I'd start here. If this should be elsewhere, an mod should feel free to move it.

    Looking for a way to batch rename files in a folder, where only a specified set of characters get changed. I can't do this through Windows (select all files > rename) b/c some of the characters get changed whereas I do not want them to, and all files are appended with (1) (2) etc., which I do not want either.

    For ex., let's say I have three files:

    snare-dry-1.wav
    snare-dry-2.wav
    snare-dry-3.wav

    - and I want to wind up with

    snare-wet-1.wav
    snare-wet-2.wav
    snare-wet-3.wav

    Is there a tool or an app that will do this?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Batch rename tool or app?

    Most any scripting language will do that. For Windows, you can use Powershell, or even plain old DOS commands. Search for a known pattern and replace text is a simple operation.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Dec 2012
    Posts
    3

    Re: Batch rename tool or app?

    Cool - powershell (or a DOS prompt) does it.

    Dir | rename-item -newname { $_.name -replace "wet","dry" }

    Thanks so much!

  4. #4
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    Re: Batch rename tool or app?

    Linux:
    Code:
    for i in snare-dry-*.wav; do mv $i `echo $i | sed 's/dry/wet/'`; done
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  5. #5
    Join Date
    Dec 2012
    Posts
    3

    Re: Batch rename tool or app?

    Thanks for that. Maybe it will help someone else tho; I am far from a Linux person.

    Hey Bio - you are a mod. I wanted to contact the forum (admin/mod - doesn't matter) about posting something. I see no option for me to pm anyone, and the contact info - webmaster@codeguru.com - is not working. I sent an email on the main site (not the forum) a few days ago, but have not received a response. What's the best way to get in touch?

    Thanks!

  6. #6
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    Re: Batch rename tool or app?

    You can contact the forum administrator, Brad Jones, by PM, see: http://forums.codeguru.com/member.php?37456-Brad-Jones

    Let me know if you have any problems!
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  7. #7
    Join Date
    Dec 2012
    Posts
    3

    Re: Batch rename tool or app?

    Quote Originally Posted by BioPhysEngr View Post
    You can contact the forum administrator, Brad Jones, by PM, see: http://forums.codeguru.com/member.php?37456-Brad-Jones
    Yeah - I see no option for me to pm him, and the contact info - webmaster@codeguru.com - is not working.

  8. #8
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Batch rename tool or app?

    That PM link works for me. Don't you see a Send Private Message link?
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  9. #9
    Join Date
    Dec 2012
    Posts
    3

    Re: Batch rename tool or app?

    Hi - that link I posted is not a PM link. It's an email link - that's what doesn't work.

    No, I do not see a Send Private Message link. In fact, if I do a ctrl+f for either Private or Message, I get zero results for both. Maybe b/c I am new?

    Anyway, I was hoping to get some help in decomiling a file, and wasn't sure which was the best/proper subforum to post.

    Thanks!

  10. #10
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Batch rename tool or app?

    Since reverse engineering an application (most likely) is against the forum rules there is no appropriate place for that. See http://forums.codeguru.com/misc.php?do=showrules
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  11. #11
    Join Date
    Dec 2012
    Posts
    3

    Re: Batch rename tool or app?

    Quote Originally Posted by S_M_A View Post
    Since reverse engineering an application (most likely) is against the forum rules there is no appropriate place for that. See http://forums.codeguru.com/misc.php?do=showrules
    I am NOT trying to reverse engineer an application.

    I see nothing in that link that speaks to reverse engineering.

    I am still interested, however, in contact info, as there is no pm on the page above, and webmaster@codeguru.com - is not working.

    Anyone withany ideas on contact info?

  12. #12
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Batch rename tool or app?

    Ok maybe I misunderstood what decompile was. Anyway, you don't have to PM Brad about what forum to use, read the forum descriptions and do your best pick. If it's the wrong forum a mod can always move the thread.

    If you still want to PM Brad here's a direct link http://forums.codeguru.com/private.php?do=newpm&u=37456
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  13. #13
    Join Date
    Dec 2012
    Posts
    3

    Re: Batch rename tool or app?

    Quote Originally Posted by S_M_A View Post
    If you still want to PM Brad here's a direct link http://forums.codeguru.com/private.php?do=newpm&u=37456
    Doesn't work.

    vBulletin Message
    riffwraith, you do not have permission to access this page. This could be due to one of several reasons:

    1.Your user account may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
    2.If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

    Dont really understand what the issue is here...

  14. #14
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,754

    Re: Batch rename tool or app?

    bjones@quinstreet.com will work for me.

    I'll have to look to see why webmaster@codeguru.com isn't working. It should be.

    As to PMs -- you have to have a certain number of posts and such before PMs are enabled in an account. This is an anti-spamming feature. A number of spammers will get on the forum and start PMing people. By forcing posts and such before allowing PMs, we eliminate that. Additionally, the forums are primarily for public communication rather than private messaging.

    Hopefully the spam filters won't eat any messages you send me

    Brad!
    -----------------------------------------------
    Brad! Jones,
    Yowza Publishing
    LotsOfSoftware, LLC

    -----------------------------------------------

  15. #15
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,754

    Re: Batch rename tool or app?

    I just tested the webmaster@codeguru.com address and it worked fine for me.
    -----------------------------------------------
    Brad! Jones,
    Yowza Publishing
    LotsOfSoftware, LLC

    -----------------------------------------------

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured