How to Change the File Extension of Multiple Files

Posted:
in Genius Bar edited October 2015
i want to change extension .JPG to .jpg to all my files..



pls guide me how to do it.

Comments

  • Reply 1 of 7
    addaboxaddabox Posts: 12,665member
    You can do it with Automator and the "Change Extension" script here. (scroll down the page a bit and click on the "Change Extension" heading of the descriptive paragraph, the script will download).



    Once the script is downloaded, open Automator from your Apps folder. In the Library column, click "Files and Folders." From the column to the right of that, click and drag "Get Specified Finder Items" into the area that says "Drag actions or files here to start your workflow." You'll see a pane appear. From the Finder, drag your folder of items to be renamed onto that pane.



    Now, from the Automator File menu item, click "Import Actions", navigate to the action you downloaded, highlight, and click "Import." Go back to your Library column and click "Recently Added", the new action will be there. Drag that under your "Get Specified Finder Items" action over on the right.



    Now you have the files selected and the change extension action ready to go. Just type in the extension you want the files to have in the "Change Extensions" action pane, and click the run button on the top right, and you're done. Just make sure you have only the files you want to change in the folder specified.
  • Reply 2 of 7
    MarvinMarvin Posts: 15,326moderator
    Try R-Name from here:



    http://www.box.net/shared/riqei9vpnl



    Download R-name3.dmg.gz. It's a great renaming utility that lets you see a preview before renaming and has a whole bunch of options.



    There's also A Better Finder Rename:



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



    which works as a contextual menu item so you select files, right-click and open the renamer.
  • Reply 3 of 7
    diogoafdiogoaf Posts: 1member


    No need to add any script to Automator, see how:


     


    How to Change Multiple File Extensions in Automator (no need to download any script):


     


    Instructions


     



    • 1


      Click "Applications" on the Dock of your Mac, and then click "Automator." The Automator template window appears.





    • 2


      Double-click the "Workflow" template's icon to open a blank workflow window.





    • 3


      Click "Files and Folders" under "Library" in the left pane of the Automator window.





    • 4


      Drag the "Get Specified Finder Items" module into the main Automator window. Click the "Add" button in this module. A dialog box appears.





    • 5


      Click the folder containing the files whose extensions you want to batch rename, then select the files, and then click "Add." The files appear in the "Get Specified Finder Items" module's window.





    • 6


      Drag the "Rename Finder Items" module into the main Automator window below the "Get Specified Finder Items" module. A message appears, asking if you would like to add a "Copy Finder Items" action, to change copies of the files and leave the original ones preserved. This can be useful if you later decide you didn't want to change the file extensions. Click "Don't Add" or "Add." The "Rename Finder Items" module's name changes to "Add Date or Time to Finder Item Names," because that is the name of the first option in the pull-down menu for this module.





    • 7


      Click the "Add Date or Time" pull-down menu in the "Add Date or Time to Finder Item Names" module window, and then click "Replace Text." The module's name changes to "Replace Text in Finder Items Names."





    • 8


      Type the extension you want to change for multiple files in the "Find" text box. Type the extension you want to use to rename the files in the "Replace" text box. Click the "Full Name" pull-down menu, and then click "Extension Only."





    • 9


      Click the "Desktop" pull-down menu in the "Copy Finder Items" module, and then click the name of the folder on your Mac where you want Automator to copy the renamed files.





    • 10


      Click the "Run" button at the top of the Automator window to rename the extensions you selected.




  • Reply 4 of 7


    Thanks so much - you just made my life so much easier!!!

  • Reply 5 of 7
    relicrelic Posts: 4,735member


    This is how you do it on the UNIX side of things.


     


    Name the program, chngext. Don't forget to, "chmod +x chngext". Usage, "chngext .JPG .jpg".


     


    <span class="com" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: gray;">#!/bin/bash
    </span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;">
    </span><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: rgb(0, 0, 139);">for</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;"> f </span><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: rgb(0, 0, 139);">in</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;"> </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;">*.</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;">$1
    </span><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: rgb(0, 0, 139);">
    do</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;">

    </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;">[</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;"> </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;">-</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;">f </span><span class="str" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: maroon;">"$f"</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;"> </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;">]</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;"> </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;">&amp;&amp;</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;"> mv </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;">-</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;">v </span><span class="str" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: maroon;">"$f"</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;"> </span><span class="str" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: maroon;">"${f%$1}$2"</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: black;">
    </span><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: rgb(0, 0, 139);">

    done</span>
  • Reply 6 of 7

    (fixed the previous answer)

    #!/bin/bash

    for f in *.$1

     

    do [ -f "$f" ] && mv -v "$f" "${f%$1}$2"

     

    done

  • Reply 7 of 7

    Pure Salvation. Deeply thank you :):)

    best regards

Sign In or Register to comment.