GP SoftwareTwitter
Opus FAQsManualCommandsObjects

MTP: Copy file paths plain (without "MTP code" characters)

Hello. I'm trying to copy file paths from a phone connected in MTP mode.
I tried all the relevant "Clipboard COPYNAMES=" arguments, but they all add strange characters (?code?) to every dir name and file name.
Example of "Clipboard COPYNAMES" output:

mtp://MpT3 (15)/?s79030001?|SD card/?o1FC6?|Music/?o11F06?|Foo/?o11F07?|bar/?o11F08?|dir 3/?o11F09?|DJ Tiësto - Adagio For Strings.mp3

I wish the output looked like this:

MpT3 (15)/SD card/Music/Foo/bar/dir 3/DJ Tiësto - Adagio For Strings.mp3

Attached is a pic of the same file as it appears in Opus. The "Location" column appears just like I want to copy the paths (except it's missing the file name at the end). The "Full Path" column adds the "?code?", but unlike the output of "Clipboard COPYNAMES", it only adds the code to the LAST entry in the path -- whether it's a dir (top) or a file (bottom).

Those are the internal MTP paths, since it's possible for two folders on MTP to have identical names and it provides a way to differentiate them. They probably shouldn't be exposed to the Clipboard command, though.

For now, try this as a workaround:

Clipboard COPYNAMES REGEX ^(.*)\?[a-z0-9]+\?\|(.*)$# \1\2

Or, if you want to remove the mtp:// prefix as well:

Clipboard COPYNAMES REGEX ^(.*)\?[a-z0-9]+\?\|(.*)$# \1\2 ^mtp://(.*)$ \1
1 Like

Thanks, that works.
BTW I don't know forum etiquette that well -- if all I'm going to say in a reply is "thank you" would you guys (who run/own the site) rather that I just click "Like" on the reply(s) that helped me? (so I don't bother you with a post you don't really need to look at, and also take up more space on your server, or add to your bandwidth usage because anyone who reads the thread will now have an extra reply to download)

No need to say "thanks". The best way to "close out" the thread if you want is to click the checkbox button that lets you mark a particular answer as the solution.

7 posts were split to a new topic: Marking a post as a solution

We'll improve this in the next beta (12.15.2), so the regex stuff won't be needed.