Getting the network path of a local path

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
FruehBird
Posts: 10
Joined: 27 Mar 2017 20:46

Getting the network path of a local path

Post by FruehBird »

Is there a way to get the network path like \\COMPUTERNAME\$J\FolderMain\SubFolder\file.txt from your local files?

What I am looking for is adding a right click option to copy the local file/folder and have it generate the network path that can be accessed from another machine on the same network.

From this:

Code: Select all

file1: J:\FolderMain\SubFolder\file.txt
file2: Desktop\FolderMain\file.txt
To this:

Code: Select all

file1: \\COMPUTERNAME\J$\FolderMain\SubFolder\file.txt
file2: \\COMPUTERNAME\C$\Users\username\Desktop\FolderMain\file.txt

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Getting the network path of a local path

Post by highend »

Scriptable (with the pro version)

Code: Select all

    $list = "";
    foreach($item, <get SelectedItemsPathNames |>, , "e") {
        $drive = gpc($item, "drive");
        $path  = regexreplace($item, "^[a-z]:\\");
        $list = $list . "\\%computername%\$drive$\$path<crlf>";
    }
    if ($list) { copytext $list; status "Network paths copied to clipboard..."; }
    else { status "No items selected, aborted!", "8B4513", "stop"; }
But you can't add context menus on your own...
One of my scripts helped you out? Please donate via Paypal

FruehBird
Posts: 10
Joined: 27 Mar 2017 20:46

Re: Getting the network path of a local path

Post by FruehBird »

That did the trick!

Thanks highend.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Getting the network path of a local path

Post by TheQwerty »

You could also use: File | To Clipboard | Item UNC Path/Name(s)
Which can be accessed from XY's 32-bit context menu if you have enabled Configuration | Menus, Mouse, Safety | Context Menus | Custom items in shell context menu and have To Clipboard checked in the File List... items dialog.

Post Reply