I have a series of files with arbitrary names and extensions. Like:

  • APW19981017.0151
  • APW19981017.0306
  • APW19981017.0477
  • APW19981017.0507
  • APW19981018.0410
  • NYT19981017.0177
  • NYT19981018.0098
  • NYT19981018.0123
  • NYT19981018.0160
  • NYT19981018.0185

I want these files to open with an editor, like TextMate or Sublime Text, on double-clicking, without having to right-click and choosing the editor from applications.

Basically the Finder should open any unknown extension file with the text editor.


1 Answer 1


Since the file extensions are all different, you will need to batch edit all the file extensions in order to have TextEdit be used as default. Clicking "change all" on one would not work: enter image description here

Assuming all the files are in the same folder and are text files, you can use a terminal command to batch edit the extensions so TextEdit opens them by default. To do so, open Terminal and do the following, replacing the /path/to/folder with the folder containing these files:

cd /path/to/folder
for file in *; do mv "$file" "${file}.txt"; done

e.g. "APW.01" becomes "APW.01.txt"

Alternative, cleaner solution: a sequential rename adding .txt to each file.

cd /path/to/folder; i=1;for f in *; do mv "$f" "APW_0$i.txt";let i++; done


enter image description here


enter image description here

  • 1
    Is there no way to specify in OSX that "if it is unrecognized extension use textedit" without having to change the extension?
    – gbansal
    Commented Jun 9, 2014 at 23:52
  • @gbansal to my knowledge, no. for example, here, you could select an individual one in finder > get info (first screen shot) and have text edit open that file by default. The problem is when you select "always open files of this type w/ Text Edit," this type=same extension. The system recognizes each numeric suffix following the "." as the extension.
    – njboot
    Commented Jun 10, 2014 at 1:29
  • @gbansal see update for command with cleaner output.
    – njboot
    Commented Jun 10, 2014 at 4:18

Not the answer you're looking for? Browse other questions tagged .