copyto/moveto issue with "[" and "*" in source parameter

Things you’d like to miss in the future...
Forum rules
When reporting a bug, please include the following information: your XYplorer version (e.g., v27.90.0047), your Windows version (e.g., Win 11), and your screen scaling percentage (e.g., 125%). We recommend adding your Windows version and screen scaling percentage to your profile or signature. This will make debugging much easier for us.
Post Reply
MikhailR
Posts: 9
Joined: 19 Nov 2012 22:49

copyto/moveto issue with "[" and "*" in source parameter

Post by MikhailR »

There is something wrong with the moveto/copyto source parameter parsing.

To reproduce, have a file named like "abc[def].txt" (content not relevant). Try copying the file somewhere with copyto function:

This works:

Code: Select all

  ::copyto("somewhere","c:\temp\abc[def].txt")
This works too:

Code: Select all

  ::copyto("somewhere","c:\temp\abc*.*")
This doesn't work (crashes XYCOPY, error below):

Code: Select all

  ::copyto("somewhere","c:\temp\abc[*.*")
--
Error: 93 (0000005D)
Desc: Invalid pattern string
Dll: 0
Proc: KFW

Source: XYCOPY
XY ver: 2.10.0077
OS: Windows 7
Date: 12/01/2015 06:21:50
--

admin
Site Admin
Posts: 64872
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: copyto/moveto issue with "[" and "*" in source parameter

Post by admin »

Thanks, confirmed.

It's not a bug since you are responsible to pass a correct pattern when using wildcards: open brackets have to be enclosed in brackets (like this: [[] ) to be treated as literal characters.

But, okay, the next version will handle it for you. NO, that would break old user code!

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: copyto/moveto issue with "[" and "*" in source parameter

Post by PeterH »

But it shouldn't crash XYCOPY?

admin
Site Admin
Posts: 64872
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: copyto/moveto issue with "[" and "*" in source parameter

Post by admin »

It's not a crash, it's an error message.

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: copyto/moveto issue with "[" and "*" in source parameter

Post by PeterH »

OK - but not really a sort of end-user-error-message, I think :roll:

MikhailR
Posts: 9
Joined: 19 Nov 2012 22:49

Re: copyto/moveto issue with "[" and "*" in source parameter

Post by MikhailR »

Hi, thanks for your quick response. I am really sorry to drag you into this in your holidays.
admin wrote:It's not a crash, it's an error message.
Well, it's an error message and technically it's not a "crash", it's a "hang".
It freezes the "Custom copy" process and it hangs in the main XY queue. You still can see its window, and in the queue, but you can't just skip or cancel it, you have to kill it manually from windows process manager.

Anyway, it wouldn't happen if the parameter are passed correctly.
Fair enough, I found the wildcard escape mention somewhere in the filters doc. But it doesn't work as expected in the source parameter of copyto:

Using the same example file:

Code: Select all

  ::copyto("somewhere","c:\temp\abc[[]def]*")
Doesn't work either, as apparently it can't find the file: "The following source item does not exist: c:\temp\abc[[]def]*" (..).

I still couldn't figure out how to workaround this literal "[" and "*" wildcard pattern as copyto source parameter.

And as a bonus issue to consider is the integration of this wildcard syntax with external copiers (like "teracopy") as it don't recognize the "*" or "[[]" the same way XYCopy does (yes, this needs another topic).

admin
Site Admin
Posts: 64872
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: copyto/moveto issue with "[" and "*" in source parameter

Post by admin »

OK, good points. I will change the code and take care of the handling of [ myself. So in this context only * and ? will be accepted as wildcards, not # (which did not work anyway I just saw), and not [...] grouping.

Post Reply