Community
    • Login

    Full file Path to Clipboard with forward slash

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 5 Posters 1.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      keep2000
      last edited by PeterJones

      I work with webpages and use Full file Path to Clipboard function a lot. When I edit a file and want to copy the path to a browser I need to replace backslash to forward slash.
      Is there an option to copy the path with forward slash instead of backslash?
      Like from
      D:\dev\websites\mydomain.com\content\pages\contact.html
      to
      D:/dev/websites/mydomain.com/content/pages/contact.html
      So when I delete the beginning, I’ll get the correct url

      It’s would be very-very usefull when you use NppFTP which stores the local file according the real directory structure of the server.

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @keep2000
        last edited by Alan Kilborn

        @keep2000

        Record the following Replace All action as a macro:

        f2ae9f62-0a79-48ab-808b-5628a54342d1-image.png

        Assign the macro to an unused keycombo.

        To use, select the text where you want the conversion to happen, and press the keycombo.

        1 Reply Last reply Reply Quote 2
        • Sector ManS
          Sector Man
          last edited by

          Try this tool… Path Copy Copy
          https:// pathcopycopy . github . io

          PeterJonesP 1 Reply Last reply Reply Quote -3
          • PeterJonesP
            PeterJones @Sector Man
            last edited by PeterJones

            @Sector-Man ,

            Please don’t suggest non-Notepad++ solutions in a Notepad++ forum, unless there is no way to do it in Notepad++. Since it was from years ago, and there were no complaints about Alan’s suggestion, there is no need for pointing to an external tool. (Further, that tool is copying paths from the Windows Explorer; the original post from two years ago was asking about copying filenames from the name of a text file open in Notepad++, so not only is your suggestion off-topic, it’s also just plain wrong.)

            1 Reply Last reply Reply Quote 2
            • mkupperM
              mkupper
              last edited by

              The recent post prompts me to think about if there would be value to adding a feature request. In the past options such as Full file Path to Clipboard were on the main right-click menu for a file tab. Within the past few years the Full file Path to Clipboard tab menu option was moved to being a sub-menu of Copy to Clipboard. This was shifted on or before v8.5.3 release in May 2023.

              As the Copy to Clipboard sub-menu is fairly short it means we could two more items to this sub-menu without cluttering the user interface.

              The Copy to Clipboard sub-options could become:

              • Copy Full File Path
              • Copy Full File Path using forward slashes /
              • Copy Filename
              • Copy Current Dir. Path using forward slashes /

              Windows now supports both backslash and forward slash but many older applications. including the command prompt only work with backslash style paths. Web developers likely will appreciate having the forward slash version available.

              Alan KilbornA 1 Reply Last reply Reply Quote 1
              • Alan KilbornA
                Alan Kilborn @mkupper
                last edited by

                As someone that has no need ever for forward slash versions, such new menu items would probably annoy me.

                @mkupper said in Full file Path to Clipboard with forward slash:

                Web developers likely will appreciate having the forward slash version available.

                Don’t some of the plugins that target web development (presuming there are some) offer such a copy operation.

                If nothing else, this behavior could easily be scripted:

                notepad.getCurrentFilename().replace('\\', '/')

                mkupperM 1 Reply Last reply Reply Quote 1
                • mkupperM
                  mkupper @Alan Kilborn
                  last edited by

                  To closer-replicate what @keep2000 was asking for I took @Alan-Kilborn’s code and created a new scriptlet

                  editor.copyText("file://" + str(notepad.getCurrentFilename().replace('\\', '/')))
                  

                  and then assigned the keyboard shortcut Alt+/ to it. Alt+/ now loads the current forward slash formatted file path into the copy/paste buffer.

                  In my case also I wanted the file:// prefix as part of the results.

                  1 Reply Last reply Reply Quote 2
                  • First post
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors