Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This has been around for a long time but most people don’t know about it:

Dragging and dropping files from the finder into an file selector window (ie. Open File in most programs) will navigate to that file and select it. As others mentioned this works in terminal as well to give you a path, but actually this generally works in any text box (unless it specifically handles paths being drag ‘n dropped). This also works with multiple files / multi file selection, and in the case of inserting the path as text, they are space delimited and auto quoted (convenient for shell use).

Edit: This icon can include the one at the top of a finder window (the window title). That’s actually interactable and can be dragged and dropped for the directory itself.



> this works in terminal as well to give you a path

I'll add that if you want the path of a file and the destination application doesn't support drag 'n' drop, right click on a file in finder, then hold the Option key and you'll see the copy command changes from "Copy" to "Copy as Pathname".


Oh my god this is so useful! I've known about the 'drag into your terminal' thing for ages but not needing to use the mouse and just doing command-option-c is so much nicer!


And if, for example, a webpage has a button to select files through the open file dialog, you can just drag and drop a file to the button and not go through the open dialog at all.


Dragging and dropping files from the finder into an file selector window

You can also drag a file or folder's icon from a Finder window title bar.

When it doesn't work, that's a good indication of a program that's using Electron, Carbon, some old framework, or poorly maintained.

Adobe and Audacity are both guilty of this.


And... command-click on the proxy icon to show its location.


Didn't realize until this comment, but I use this feature all the time. Open file in a program, then use spotlight to find the file I want, drag it into the open modal.


I use the path version of this all the time for some really long path names :) . I keep those folders open just for that particular purpose. Very handy. It also works for selected text. Works on linux too. I honestly don't know about windows.


Speaking of space delimited, you can also grab a whole directory full of any item and drop into numbers or excel and it will create a list of said files. Tab delimited. Great for inventorying media etc.


This doesn't work for me. Are you dropping the full folder or all the items in it? And you are dropping onto a table in Numbers?


Related: Cmd + Mission Control (F3) temporarily shows your desktop.

Hit it once, start dragging, then hit it again to bring back your apps to drop into.


A variant of this is dragging to the terminal. I drag stuff from Finder to a terminal window all the time to get the full pathname.


The nicest thing is that it auto-escapes the path too so you can safely type a command and then drag any file as an argument without worrying about spaces and shell characters.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: