After years of using MacOS I somehow only just now became aware you even could copy the filepath at all (outside of dragging in to terminal which is just stupid) so I’m very happy to discover that, but the thing is, for the most part the reason I want to do this is for easy navigation of a file browser by copying paths from one window or tab to another, especially when I have an item selected in an open file browser window and need to specify in a file browser prompt where to save something.

In those instances on Windows for example, I will press the F4 key to select the text field of the address bar in explorer and copy the parent directory path of an item. If I really need it I can get the exact path of the item itself without the mouse too . While I’m super glad I can now approach this usefulness in Finder, the mouse totally interrupts the flow and begins to make the increased efficiency from copying paths only marginally better than just clicking through folder trees since you stop what you’re doing and move hands to the mouse already anyway at that point. I’d love to just immediately copy the current path I’m in into a Finder window and use the cmd+shift+G option in another window or prompt to go the same place. The second half of that operation is easy enough, but getting the path on to the clipboard isn’t because of needing the mouse.

  • RotaryKeyboard@lemmy.ninja
    link
    fedilink
    English
    arrow-up
    7
    ·
    10 months ago

    Commnad-option-C will copy the path of the currently-selected folder or file to the clipboard. If you use a finder replacement like PathFInder, you get this behavior with just command-C.

    • JimmycrackcrackOP
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      10 months ago

      No shit. This is great!

      Maybe you have even more helpful keyboard-fu: how can I quit textEdit/close a textEdit document and either:

      • Choose not to save at all or
      • Choose to save somewhere and pick a location and filename to do so WITHOUT touching the mouse?

      Especially the quit without saving thing. I used to do this all the time by pressing the tab key on the save prompt to select ‘don’t save’ but on Ventura the ‘delete’ (as opposed to ‘don’t save’ button) doesn’t seem to be accessible from tabbing as it just keeps selecting the tags dropdown list, or the filename field and alternating between the two, completely ignoring the remaining buttons.

      I did figure out how to save and choose a location without the mouse, but it’s kind of irritating unless I already have the full path in the clipboard. I can use the go to folder prompt in the finder save prompt which will after a fashion work but kind of annoying, I have a proper finder interface built in to the prompt where I can navigate down folder trees in column view or list view and any of the finder views and could do so comfortably if only it’d just let me select any one of the folders represented there without clicking.

      • RotaryKeyboard@lemmy.ninja
        link
        fedilink
        English
        arrow-up
        4
        ·
        edit-2
        10 months ago

        Okay, I have a lot of recommendations here.

        how can I quit textEdit/close a textEdit document and either:

        Choose not to save at all or

        To my knowledge, this can’t be done. Choose a different text editor, such as BBEdit instead. In BBEdit, if I want to choose not to save, I press Command-W to close the window. The “Save changes before closing?” dialog box will accept Command-D as input for the “Don’t Save” button. BBEdit also has command line utilities, which I will come back to.

        Choose to save somewhere and pick a location and filename to do so WITHOUT touching the mouse?

        You have already answered this one. All application Save As dialog boxes accept the command-shift-G (Go to) command. You can then type the path to where you want to save your file and use tab-completion to make it go faster. Saving files in locations that can be accessed with tilde expansion will dramatically speed your workflow.

        For example, I often work on little projects that involve editing lots of files. I will choose to put my project directory in my home directory so that I can access it with the following keystrokes:

        1. Command-Shift-S (Save As)
        2. Command-Shift-G (Go to)
        3. ~/Rot(tab)/Proj(tab) (which tab-completes to /Users/RotaryKeyboard/Project1/)
        4. (enter)

        But what I keep thinking about while reading your post is how much you should be working with an open terminal window. The zsh commands you can use there will change your life. It requires learning unix, and it requires you changing the way you work a bit, but I can immediately think of approaches that would make it so that you never have to use the Go To command again. Let’s walk through that now.

        In Linux/Unix, it is not uncommon to create your file in a location before you even edit it. For example, I can do this:

        touch ~/Users/RotaryKeyboard/Project1/tutorial.py

        This creates an empty file at that location. Now I can open the file, edit it, and save it, and I don’t have to specify where. My hands never have to leave the keyboard. But we can do better:

        nano ~/Users/RotaryKeyboard/Project1/tutorial.py

        Now I’ve opened the text editor nano. I can write in that file. When I save it, it will be saved at that location. But we can do even better.

        Remember how I mentiuoned that BBEdit has command line tools? Once those are installed, we can use bbedit as the text editor instead of nano.

        bbedit ~/Users/RotaryKeyboard/Project1/tutorial.py

        As you might have guessed, this opens a new BBEdit text window. The BBEdit developers have gone the extra mile, though. That empty BBEdit window will have the name you passed to it in the title bar as well as the path to the file visible in the toolbar even though the file doesn’t even exist until you save it.

        So far so good, right? Once you start using a terminal window in your workflow, you can begin to take advantage of things like environment variables, symbolic links, and commands like find and grep to rapidly increase your productivity.

        Oh, one more thing: if you don’t know how to use regular expressions, set aside some time to learn how to use them. Regular Expressions are probably the single most life-changing thing I’ve ever come across for computers.

  • noahm
    link
    fedilink
    arrow-up
    3
    ·
    10 months ago

    ⌥⌘C

    Another tip:
    In the Edit menu in Finder, hold down the ⌥ key. You will see Copy “myfile.png” change to Copy “myfile.png” as Path Name. That is how I got the keyboard shortcut.

  • JimmycrackcrackOP
    link
    fedilink
    arrow-up
    3
    ·
    10 months ago

    Actually, no sooner than I finished writing this post did I find a solution that works 90% of the way there. I can bring up the go to folder prompt with cmd+shift+G already, but I realised if I want it to tell me the current folder I can just type “.” and it will display the current path and you can also just cmd+c to copy that to the clipboard. I should have realised that the go to folder bar behaves just like terminal in many ways so there’d be common commands for both.

    I guess this isn’t a complete solution because if I wanted the filepath of a selected object in Finder it wouldn’t work as it would only give you the parent directory, but that’s actually what I need probably more than 90% of the time and given the rest of the time where I need a full filepath for one specific object is so rare, it’s really not a problem to have to occasionally use the mouse.