The directory that was dragged will then open in the application it was dragged to (if the app accepts the path). What happens at the low level?

How does the application know it can open that path? How does Finder provide the application with the path to open?


At a low level, everything on the disk is a file. So a folder is a special file that contains directory information pointing to more files.

The application is told that the file should be opened - and it's up to the program to determine what type of file was passed and decide whether to recursively handle that file by reading the files contained in that folder or take some other action.

Similarly, you can select many items in Finder and drop them on an icon and the same sort of file open event is posted to the application so that it can process the files and do what needs to be done.

  • Thank you for the response, @bmike, that makes sense! How would one go about telling an app (using a script or something along those lines) to do a general "Open" command on a path? – Tyler Bell Aug 1 '12 at 18:50
  • 2
    This might be useful as a separate question, but in a bash script you could do open -a Application /path/to/open – robmathers Aug 1 '12 at 18:59
  • 2
    Also, @TylerBell, you can simply use open /path/to/file on the command line/in a script, and the file will be opened with the default application for that file type. For directories, that's Finder. – Travis Northcutt Aug 1 '12 at 19:04
  • You all are awesome, thank you for the great answers @tnorthcutt – Tyler Bell Aug 1 '12 at 19:10
  • 1
    @TylerBell you're welcome. I see you're new here; don't forget to upvote helpful answers and comments and mark an answer as accepted if it answers your question. – Travis Northcutt Aug 1 '12 at 19:15

You must log in to answer this question.

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