FOAK: XP mass file rename

Discussion in 'UK Motorcycles' started by Jeremy, Jul 5, 2006.

  1. Jeremy

    Steve Parry Guest

    true enough, point well made, either way I'm just amazed how people
    automatically think they need a utility to do "stuff" within Windows, or
    whine it cannot do "stuff".
     
    Steve Parry, Jul 5, 2006
    #21
    1. Advertisements

  2. Jeremy

    Steve Parry Guest

    See Andrews input down there VVVVV perhaps put mulitple ???? to allow for
    the amount of digits in the centre or maybe a *
     
    Steve Parry, Jul 5, 2006
    #22
    1. Advertisements

  3. Jeremy

    Jeremy Guest

    Perhaps I wasn't clear.

    This folder has 1365 files in - each of course with a unique name.

    Some examples:
    Alert.png
    Bulb On.png
    Calendar 31 day.png

    Which need to become

    alert.png
    bulb_on.png
    calendar_31_day.png

    It's academic really as I used the tool that Dan suggested to complete
    but I would like to know if, as you suggest, it is possible to do this
    easily from within the command prompt window.



    --

    jeremy
    '01 Triumph Sprint ST in green
    _______________________________________
    jeremy0505 at gmail.com
     
    Jeremy, Jul 5, 2006
    #23
  4. Jeremy

    Jeremy Guest

    From original post:
    I'll be clearer next time.


    --

    jeremy
    '01 Triumph Sprint ST in green
    _______________________________________
    jeremy0505 at gmail.com
     
    Jeremy, Jul 5, 2006
    #24
  5. Jeremy

    antonye Guest

    Save this as "rename.vbs" in the target directory.

    Edit it so that the sPath is the name of the folder, and the sExt
    is the name of the extension you wish to check (to filter for
    just .gif files, for example).

    Double click it in Windows Explorer and it should do the trick.

    It will only match when there is a space in the name...

    -- 8< -- cut here -- 8< --

    sPath = "c:\temp\folder\"
    sExt = ".gif"

    Set fsoObject = CreateObject("Scripting.FileSystemObject")
    Set fsoFolder = fsoObject.GetFolder(sPath)
    for each fsoFile in fsoFolder.Files
    if InStr(fsoFile.Name, " ") AND (Right(fsoFile.Name, Len(sExt)) =
    sExt) then
    sNewName = Replace(fsoFile.Name, " ", "_")
    fsoFile.Name = LCase(sNewName)
    end if
    next
    Set fsoFolder = Nothing
    Set fsoObject = Nothing
     
    antonye, Jul 5, 2006
    #25
  6. Jeremy

    darsy Guest

     
    darsy, Jul 5, 2006
    #26
  7. Jeremy

    darsy Guest

    good point, very well made.
     
    darsy, Jul 5, 2006
    #27
  8. Jeremy

    darsy Guest

    it doesn't set my teeth on edge. I feel the same way about Excel
    "Gurus" as I do about any other socially inadequate group with mild
    mental illness.
     
    darsy, Jul 5, 2006
    #28
  9. Jeremy

    Jeremy Guest


    <snip vbs code>

    Thanks for this Antony - when I have a spare minute I might have a play
    with this but already the problem is solved (have renamed approx 2000
    files now).


    --

    jeremy
    '01 Triumph Sprint ST in green
    _______________________________________
    jeremy0505 at gmail.com
     
    Jeremy, Jul 5, 2006
    #29
  10. Jeremy

    antonye Guest

    No worries - it was an exercise in remembering how to
    do it anyway, as I'd written a similar script a couple of
    years ago and so knew it could be done quite easily!
     
    antonye, Jul 5, 2006
    #30
  11. ukrm, for example...
     
    Soylent Green, Jul 5, 2006
    #31
  12. Jeremy

    Nicknoxx Guest

    Essential reading IMO
     
    Nicknoxx, Jul 5, 2006
    #32
  13. Jeremy

    darsy Guest

    no, though I read "Eleanor Rigby" last month.

    Is jPod any good?
     
    darsy, Jul 5, 2006
    #33
  14. Jeremy

    darsy Guest

    but...it's a *blog*
     
    darsy, Jul 5, 2006
    #34
  15. Jeremy

    darsy Guest

    "fan" might be a bit strong, though I have liked most of his stuff
    that I've read.
     
    darsy, Jul 5, 2006
    #35
  16. Jeremy

    Nicknoxx Guest

    Well yeah, you don't have to read it ALL and it does go a bit ott on DRM
    but other than that, quite a well put together doodah.
     
    Nicknoxx, Jul 5, 2006
    #36
  17. Jeremy

    Jeremy Guest

    More difficult or actually not possible? Even though the problem is
    solved, I'm still interested to know Steve's solution.

    --

    jeremy
    '01 Triumph Sprint ST in green
    _______________________________________
    jeremy0505 at gmail.com
     
    Jeremy, Jul 5, 2006
    #37
  18. Jeremy

    raden Guest

    Should rename it Heinz then
     
    raden, Jul 5, 2006
    #38
  19. Jeremy

    antonye Guest

    Or you could just use the Windows Scripting Host [1],
    as per my solution [2], and do it all in one script.

    [1] He did say XP, and it comes as standard
    [2]
    http://groups.google.com/group/uk.rec.motorcycles/msg/59db64ac1ac3d0f7
     
    antonye, Jul 6, 2006
    #39
  20. Jeremy

    antonye Guest

    It is in Windows as well, you just have to know how to do it.
     
    antonye, Jul 6, 2006
    #40
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.