MacOS – Open files with same extension in different directories with different applications

filefile extensionsfilesystemmacos

Say I have mp3 music in directory 'A' which I want to open with iTunes. And I have some more mp3 files in directory 'B' which I want to open with VLC player.

How can I set the default 'application' for each set of files and store it permanently in OSX Mavericks? The idea of having a single application type per extension and using 'open with' is too painful to use on a repeated basis.

(Now, answering the 'why' – to be honest, I dont have this requirement with mp3 files but with source code from different projects. Due to project specific requirements, certain application works best for a source file in project 'A' and another application works right in project 'B')

Best Answer

That is possible with Folder Action.

Means your files have to be in separate folders.

I assume you mean Folders when you say Directory.

As step one lets create a Automator flow for Folder Action.

Folder Action

Step 2 select the folder you want and create the work flow by dragging following in to it. You are done with this step, save it under a name you want for future references.

Automator flow

Step 3: In finder right click on the folder you want this to work on and select Services- Folder Action Setup..

In the pop up window select the file you just created. (yourfile.workflow)

Pop up

That's it, now all files inside that folder will be opened with specified application, so you can now set that for other folders using the above procedure to set other applications to open same file type. It will do it automagicaly from now on as soon you drop a new file in the folder.