MacOS – how to find files with .j or .jp extension

findermacosspotlightterminalunix

I have some image files that have a messed up extension. The files are of the following format:
"filename."
"filename.j"
"filename.jp"

I need to find all these files which are in several folders and rename all of them to .jpg.

Anyone can show me a quick way to look for all these files?
Also once I find them how can I rename all of them to .jpg in batch?

Best Answer

Assuming you are running Yosemite...

  1. Open a Finder window and navigate to the parent folder that contains all of these files.
  2. Hit CMD and F to convert it to a Spotlight search window.
  3. Select your folder as the search target in the bar just under the toolbar (in the screenshot below I've selected "Downloads"). Unless you changed the setting in the Advanced pane of Finder Preferences it'll default to "This Mac" but it should offer whichever folder you selected in step 1 as an option.
  4. Open the search attribute dropdown by clicking on Kind, search for "File extension", tick it and click OK.
  5. Enter the extension you want to search for. The window should update quickly with your results. Example of Spotlight searching for file extensions
  6. Select all the files it finds, right-click and select "Rename..."
  7. Enter ".j" in the "Find:" box and ".jpeg" in the "Replace with:" box. I'd include the dot at the start of the extension just to make sure it doesn't replace any letters anywhere else in the filename.
  8. Click "Rename". Then "Use .jpeg" at the prompts (unfortunately it'll ask you once for each file). It should rename all the selected files. Example of Finder batch renaming in Yosemite

Then repeat for ".jp".