24/7 Support - 800.608.6482

Miva Merchant Community Forums

Page 1 of 2 1 2 LastLast

Thread: How can I batch truncate/rename file names?

  1. #1
    Join Date
    Mar 2008
    Posts
    630

    Default How can I batch truncate/rename file names?

    Say I have a directly of 5 files, named as follows:
    1234-123.jpg
    2345-13.jpg
    3456.jpg
    5678 M.jpg
    4567_3.jpg
    I'd like to batch rename them by truncating after the fourth character and then adding the file extension:
    1234.jpg
    2345.jpg
    3456.jpg
    5678.jpg
    4567.jpg
    Is there some free utility that can do this for me?
    Bronson Design Studio, LLC
    Website: bronsondesign.com
    Facebook: facebook.com/bronsondesign

  2. #2
    Join Date
    Apr 2006
    Location
    Michigan
    Posts
    832

    Default Re: How can I batch truncate/rename file names?

    Not free, but if you had Filemaker Pro at hand or maybe even excel -
    create a "calculation" to get the left 4 characters and then concatenate the results with ".jpg"

    In Excel -
    Code:
    CONCATENATE((LEFT(A1,4)),".jpg")
    Oops files not names, hmmm
    On the Mac anyway it will do file name changes by the batch built in - not sure if it will do the GET off hand
    Last edited by Barrett; 12-02-08 at 06:58 PM.
    Thanks,
    -Barrett
    Favorite Host Hostasaurus.com
    Order Processing by Shipworks.com
    Kindly Suggesting to:
    *Dump Explorer and http://GetFireFox.com
    *Post a meaningful subject line.
    *Click the # button before pasting code

  3. #3
    Join Date
    Mar 2008
    Posts
    630

    Default Re: How can I batch truncate/rename file names?

    Quote Originally Posted by Barrett View Post
    Not free, but if you had Filemaker Pro at hand or maybe even excel -
    create a "calculation" to get the left 4 characters and then concatenate the results with ".jpg"
    I know how to do those operations in excel, but how does that help me rename files in a directory?
    Bronson Design Studio, LLC
    Website: bronsondesign.com
    Facebook: facebook.com/bronsondesign

  4. #4
    Join Date
    Apr 2006
    Location
    Michigan
    Posts
    832

    Default Re: How can I batch truncate/rename file names?

    Thanks,
    -Barrett
    Favorite Host Hostasaurus.com
    Order Processing by Shipworks.com
    Kindly Suggesting to:
    *Dump Explorer and http://GetFireFox.com
    *Post a meaningful subject line.
    *Click the # button before pasting code

  5. #5
    Join Date
    Mar 2008
    Posts
    630

    Default Re: How can I batch truncate/rename file names?

    Thanks...I'll take a look.
    I tried something from download.com a few months back, but was over complicated for what seems like a trival task.
    Bronson Design Studio, LLC
    Website: bronsondesign.com
    Facebook: facebook.com/bronsondesign

  6. #6
    Join Date
    Apr 2006
    Location
    Michigan
    Posts
    832

    Default Re: How can I batch truncate/rename file names?

    This might do it for the Mac users

    http://www.publicspace.net/ABetterFinderRename/

    Just tested this and it works great.
    Use the truncate function for the task specified in thread.
    Last edited by Barrett; 12-02-08 at 07:33 PM.
    Thanks,
    -Barrett
    Favorite Host Hostasaurus.com
    Order Processing by Shipworks.com
    Kindly Suggesting to:
    *Dump Explorer and http://GetFireFox.com
    *Post a meaningful subject line.
    *Click the # button before pasting code

  7. #7
    Join Date
    Mar 2008
    Posts
    630

    Default Re: How can I batch truncate/rename file names?

    Quote Originally Posted by Barrett View Post

    OMG, the ReNamer program is amazingly simple to use and lighting fast. Thanks Barrett!
    Bronson Design Studio, LLC
    Website: bronsondesign.com
    Facebook: facebook.com/bronsondesign

  8. #8
    Join Date
    Mar 2006
    Posts
    1,956

    Default Re: How can I batch truncate/rename file names?

    I use 1-4a Rename (Superb Batch Renamer) and I really like it. It has more of an explorer interface than ReNamer which I like more, but the renaming doesn't look as powerful.

  9. #9
    Join Date
    Jun 2008
    Posts
    1,114

    Default Re: How can I batch truncate/rename file names?

    Geez.. I know I"m going to show my age here (or longevity in geekdom)

    Are you on a windows machine? well, linux or mac either doesn't matter.
    You don't have to buy or get any software.. your pc will do it already.
    You just need to use the command prompt and drop into dos.

    If you don't know how... click on start, then in the (on vista) search box type
    cmd.exe

    this will pop up a black window.

    now us old geeks remember what the command DIR and CD do.

    CD means change directory
    dir means show me the files in this directory

    Change directories to get to the folder you need to rename things in.

    (fyi.. you might want to make a copy of that folder in case you screw up).

    now...
    while you are in that folder.
    you can rename using the RENAME command.

    if you need help type
    RENAME /?
    it will give you an example..

    Here is the 'magic' part.. you can use wildcards.
    ? means one character
    * means any number of characters in a row

    to play with it safely try out the wildcards with the DIR command
    DIR
    DIR *.jpg
    DIR ?.jpg
    DIR ??????.jpg
    for the ? type searches you might not get any results if you do not have
    a nameed file that followed that pattern. try this to see what happens
    DIR *.??g
    should show you anything that ends with . 2 characters and a g

    you can use these wildcards on rename too.
    If you put a ? in a slot in the first name..
    and in the second name it won't change that slot if you put a ? there too.
    And if you leave out, you can effectively remove a character from a filename.

    simple single file renaming goes like this
    rename myfile2kkk.jpg myfile2k.jpg

    But using wildcards you can batch rename a bunch of files too.
    you can shorten and insert characters.
    It's very powerful

    For example: say I have the files named setup(2).exe and setup(3).exe

    rename setup(?).exe setup(?k).exe

    results in setup(2k).exe and setup(3k).exe

    remember the ? represents a slot such as 3rd character, it isn't a variable that will hold a value, so you can't use it to shift things around.

    But if you want to truncate a whole bunch of files to 4 characters and an extension. It's fast, it's easy, and you already have it.


    psst.. be careful that you won't result in duplicates filenames because if it will, the following renames will over write the earlier rename.

    If you have used naming conventions and only want to rename files that have a specific pattern in them
    then you can do somethine really wild like

    rename ????ly*.exe ????.exe

    will take any file starting with 4 characters, then the letters ly, then any number of characters followed by .exe
    and rename it to the first 4 characters followed by .exe

    It won't rename any files that do not have 4 characters, an ly and a .exe on the end.

    anyway.. hope this ramble helps.

    You might want to google "DOS rename" or "DOS rename command"

    for more examples.

  10. #10
    Join Date
    Jun 2008
    Posts
    1,114

    Default Re: How can I batch truncate/rename file names?

    fyi.. I do this on my MAC too since it is possible to use a terminal window.
    On a mac instead of dir the directory command is ls (I suppose for list)
    and the rename command itself is a different word since it's a linux environment.
    On a mac you'd use the
    mv
    command to rename files this way.

Posting Rules

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