Full file Path to Clipboard with forward slash
-
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 urlIt’s would be very-very usefull when you use NppFTP which stores the local file according the real directory structure of the server.
-
Record the following Replace All action as a macro:
Assign the macro to an unused keycombo.
To use, select the text where you want the conversion to happen, and press the keycombo.
-
Try this tool… Path Copy Copy
https:// pathcopycopy . github . io -
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.)
-
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 theFull file Path to Clipboard
tab menu option was moved to being a sub-menu ofCopy 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.
-
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('\\', '/')
-
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.