Open files using Text Edit by default 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.
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:


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


Before:



After: