Button to copy files from WSL path to Windows Desktop

Hi,

I browse WSL directories in Opus (e.g. \\wsl.localhost\Ubuntu\home\lider\kod\).

When I copy files from WSL to Windows Desktop using Opus's normal copy, it sometimes silently skips files. Copying via terminal (cp/rsync inside WSL) works perfectly.

I want a toolbar button that reliably copies selected files from a WSL UNC path to C:\Users\lider\Desktop\.

I tried a MS-DOS Batch button with robocopy:

robocopy "{sourcepath$}" "C:\Users\lider\Desktop" "{file$}" /R:3 /W:1 /COPY:DAT

This fails with ERROR 161 "The specified path is invalid" - seems like the trailing backslash from {sourcepath$} breaks the quoting.

I also tried adding a dot ({sourcepath$}.) but that didn't help either.

What is the correct approach for this? JScript button? Different command?

Opus 13.21, Windows 11, WSL2 Ubuntu 24.04.

Thanks!

{sourcepath$|noterm} will suppress the trailing backslash.

FWIW, you should also be able to copy the files using Opus's copy command, without involving Robocopy.

Thanks Leo!

Quick follow-up: The reason I was trying robocopy instead of Opus's built-in Copy is that Opus's normal copy sometimes silently skips files when copying from WSL UNC paths. Is this a known issue? Would using the Copy command in a button behave differently than a regular drag-and-drop copy from WSL paths?

That isn't a known issue. If you can give us reproducable steps we can investigate.

Please check if any Copy Filter is turned on in Opus (visible inside the Copy Files button's menu part), and also if the same happens when doing the same copy using File Explorer, or if there is any pattern to which files are skipped (e.g. do they have names that aren't allowed on the Windows side?).

Thanks Leo.

I'll check the Copy Filter setting and test with File Explorer as well.

The skipped files don't seem to follow a pattern - no special characters in names, regular .rs and .toml files. It happens inconsistently, sometimes all files copy fine, sometimes a few are silently missing. I'll try to reproduce it and report back with specific steps.

Regarding the button: I'll use your {sourcepath$|noterm} tip with robocopy for now. Should I also try Opus's built-in Copy TO command as an alternative?

Hi Leo,

I tried this MS-DOS Batch button:

robocopy "{sourcepath$|noterm}" "C:\Users\lider\Desktop" "{file$}" /R:3 /W:1 /COPY:DAT

I selected a file in a WSL directory and clicked the button. Nothing visible happened - no error window, no file copied to Desktop.

What am I doing wrong?

Does the same syntax work (replacing the {...} codes with what they'd insert) from a command-line? My guess is the Robocopy command is incorrect, but it's not a tool I have used in years so I'm not sure.

I would use Opus's copy command if you can. You'll get a better interface from it and simplify things.

Copy TO /desktop should be all you need to copy all selected items to the desktop.


Thanks Leo. I changed the button to:

Copy TO /desktop

Type: Standard Function (Opus or external)

I selected a folder in a WSL directory and clicked the button. Got this error:

"An error occurred copying 'lib64': The system cannot find the path specified. (3)"

The folder contains Linux symlinks like lib64. Is there a way to skip symlinks or handle this?

It would normally try to copy what the symlink points to, assuming it exists and can be seen from the Windows side.

Copy Filters can be configured to skip symlinks. For detailed help, please link your account.

Thanks Leo. Single files copy fine with Copy TO /desktop. The symlink error only happens when copying folders.

How do I configure Copy Filters to skip symlinks?

Thanks for your help Leo. I'm going to give up on this for now and stick with copying via WSL terminal instead.