Copyto with pound sign (#)

Discuss and share scripts and script files...
Post Reply
hermhart
Posts: 213
Joined: 13 Jan 2015 18:41

Copyto with pound sign (#)

Post by hermhart »

I'm using a script to copy several files and some of the files that I have use a pound sign (#) in them. But for some reason any files with the # in their name fail when using 'copyto', and I am wondering if anyone has any suggestions.

Filename example would be:
1234#678a66000~a.txt

I am using the following regex to break apart the filename into parts to be wildcards:
([0-9a-z_#\-]*)([a-z0-9]{3})([0-9]{3})~([0-9a-z\-]*)\.([a-z]*)

So after using my regex, what the copyto command would look for would be, but fails on:
1234#678*~a.txt

Does anyone know how to fix this so it doesn't fail on the copyto for a filename like this (1234#678*~a.txt)?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Copyto with pound sign (#)

Post by highend »

It's interpreted as a digit (the #) and the filename doesn't have a digit at that place. Don't know if this can be changed, escaping it ([#]) does not work here. I'd suggest to use a ? instead.
One of my scripts helped you out? Please donate via Paypal

hermhart
Posts: 213
Joined: 13 Jan 2015 18:41

Re: Copyto with pound sign (#)

Post by hermhart »

That worked! Thank you, highend!

Post Reply