+ Reply to Thread
Results 1 to 7 of 7

Batch Change .JPG File name: space with a dash

  1. #1
    Registered User
    Join Date
    06-18-2010
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    59

    Thumbs up Batch Change .JPG File name: space with a dash

    Hello, just wondering if i could recieve any help with the following problem.

    I have a list of pictures that are named according to a certain part number in a folder. These pictures are in the following format:
    "XXX-XXX-XXX-XXX ABC-XXX-XXX.jpg"

    I wanted to see if there was a way to batch convert these picture file names within the folder. I wanted to repalce the space before "ABC" into a dash to make a consistent format that looks like the following:
    "XXX-XXX-XXX-XXX-ABC-XXX-XXX.jpg"


    Thanks
    Last edited by vargs; 06-22-2010 at 10:54 AM.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Batch Change .JPG File name: space with a dash

    Try this - altering the path to suit:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    06-18-2010
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Batch Change .JPG File name: space with a dash

    thanks for the reply,

    i tried typing this into run

    shell "cmd.exe /c ren ""C:\Documents and Settings\Desktop\pictues\204-031-088-005 AGF-002-001.jpg"" C:\Documents and Settings\Desktop\pictures\204-031-088-005-AGF-002-001.jpg

    I got an error saying windows canot find 'shell". Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search.

    I then removed the word shell and it ran without an error but did not change the picture name as intended.
    Last edited by vargs; 06-22-2010 at 10:34 AM.

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Batch Change .JPG File name: space with a dash

    You weren't supposed to replace the question marks, just the file path. And that's VBA code, not destined for the run dialog. To run it as a macro in Excel:
    Please Login or Register  to view this content.
    and run the RenameFiles macro.

  5. #5
    Registered User
    Join Date
    06-18-2010
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    59

    Smile Re: Batch Change .JPG File name: space with a dash

    The code ran perfectly.

    Thank you very much!

  6. #6
    Registered User
    Join Date
    02-26-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Batch Change .JPG File name: space with a dash

    Well is there any code for replacing different .jpg files ? Like if i have a file name "my name is jamal.jpg", "i am a student.jpg" to my-name-is-jamal.jpg, i-am-a-student.jpg

    please let me know i have 1000's of files to replace.

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Batch Change .JPG File name: space with a dash

    kmjamal,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1