Page 1 of 1

Getting the network path of a local path

Posted: 28 Mar 2017 16:56
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

Re: Getting the network path of a local path

Posted: 28 Mar 2017 17:11
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...

Re: Getting the network path of a local path

Posted: 28 Mar 2017 18:02
by FruehBird
That did the trick!

Thanks highend.

Re: Getting the network path of a local path

Posted: 28 Mar 2017 18:16
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.