Page 1 of 1

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

Posted: 01 Jan 2016 09:36
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
--

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

Posted: 01 Jan 2016 14:42
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!

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

Posted: 01 Jan 2016 17:25
by PeterH
But it shouldn't crash XYCOPY?

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

Posted: 01 Jan 2016 18:07
by admin
It's not a crash, it's an error message.

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

Posted: 01 Jan 2016 18:19
by PeterH
OK - but not really a sort of end-user-error-message, I think :roll:

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

Posted: 01 Jan 2016 19:06
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).

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

Posted: 01 Jan 2016 21:03
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.