batch file renamer

Discussion in 'OT Technology' started by THE. wes, Jan 24, 2010.

  1. THE. wes

    THE. wes New Member

    Joined:
    Jul 2, 2006
    Messages:
    1,867
    Likes Received:
    0
    Location:
    lexington, ky
    I have 10 folders of pictures that have approx. 40 pictures a piece in each. i want to add them all to one folder and re-name them with 4 digit numbers sequentially. as of this point in time, all 10 folders have "untitled-1.jpg" through "untitled-40.jpg".

    does anyone know of a batch file re-namer that will let me end with with one folder with "0001.jpg" through "0400.jpg"?
     
    Last edited: Jan 24, 2010
  2. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    Save this as a batch file:

    Code:
    SETLOCAL EnableDelayedExpansion
    for /r c:\RootOfPics %%i in (*.jpg) do (
    	set /a counter+=1
    	set filename=000!counter!
    	set filename=!filename:~-4!
    	copy %%i c:\Output\!filename!.jpg
    	)
    Change the directory names as required (output directory needs to be created first)
     
  3. THE. wes

    THE. wes New Member

    Joined:
    Jul 2, 2006
    Messages:
    1,867
    Likes Received:
    0
    Location:
    lexington, ky
    i changed the directories like you said, but no new files ever showed up.
     
  4. negative zero

    negative zero New Member

    Joined:
    Oct 27, 2003
    Messages:
    6,328
    Likes Received:
    0
    Location:
    the Watchtower
  5. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    If they have any spaces, you'll need to add quotes.
     
  6. THE. wes

    THE. wes New Member

    Joined:
    Jul 2, 2006
    Messages:
    1,867
    Likes Received:
    0
    Location:
    lexington, ky
  7. THE. wes

    THE. wes New Member

    Joined:
    Jul 2, 2006
    Messages:
    1,867
    Likes Received:
    0
    Location:
    lexington, ky
    ahhh, that could be the problem.
     
  8. Supernaut

    Supernaut New Member

    Joined:
    May 20, 2003
    Messages:
    8,047
    Likes Received:
    0

Share This Page