Author Topic: Copying full paths of selected files with Linux-style path delimiter  (Read 98 times)

xiubo

  • Contributor
  • Newbie
  • *****
  • Posts: 4
    • View Profile
I frequently find myself needing to copy full paths of files and paste them into programming environments (e.g. terminals, source codes, etc.). By default, Multi Commander sends Windows-style file paths where backslashes are used as delimiters between folders; unsurprisingly, most programming environments treat those as invalid paths due to the escape-semantics of the backslashes. The following script will copy full paths of currently selected files in the explorer panel and replace the backslashes with forward-slashes before sending them to the clipboard:

Code: [Select]
@var $paths = GetSelectedPaths();
@var $result = "";
@var $i;
@var $N = arrayCount($paths);
for ($i = 0; $i < $N; $i++) {
$result = $result + StrReplaceChars( $paths[$i], "\\" , "/" ) + "\n";
}
SetClipboardText(StrTrim($result, "\n"));

Hope people may find this useful.