Amiga.org

Amiga computer related discussion => Amiga Software Issues and Discussion => Topic started by: AmigaMance on August 03, 2006, 05:39:29 PM

Title: What's the problem with parenthesis containing filenames?
Post by: AmigaMance on August 03, 2006, 05:39:29 PM
It seems that AmigaDos is unable to handle filenames that contains parenthesis. It can not copy, rename, delete them and so on.
 For example, copy dh7:my_file(new).txt ram: fails until i use the WorkBench, open the window of dh7: and rename the file by removing the (). Then AmigaDos can handle the file properly. Why is this happening?
Title: Re: What's the problem with parenthesis containing filenames?
Post by: mr_a500 on August 03, 2006, 05:56:06 PM
Hey, you're right. It happens with delete and rename too.

I never noticed this because I always use a filemanager (ABCdir) for copying and deleting and there is no problem with these filenames in the filemanager.
Title: Re: What's the problem with parenthesis containing filenames?
Post by: Karlos on August 03, 2006, 05:59:16 PM
I guess you are not familiar with amigados wildcard syntax?

The following are reserved for pattern matching:

( ) [ ] ~ | # ? % `

Here's what they do

? matches any single character. so a? matches all 2-letter words beginning with a.

# matches zero or more copies of whatever follows it, so b#a matches b, ba, baa, and so on.

() groups expressions together - useful in combination with | and ~

~ negates the meaning of whatever follows it. Hence ~(#?.info) matches everything which doesn't end in .info

| represents an either/or choice. e.g. foo.(txt|doc) will match both foo.txt and foo.doc

[] defines a letter range. e.g. [a-d].txt will match a.txt, b.txt, c.txt and d.txt,

% matches the null (empty) string. Never really found much use for this one :-)

` escapes the next character if it is any of the above wildcards. You'd need this for your brackets to suppress their wildcard meaning.

The most common combination wildcard is #? means any quantity of anything, i.e. everything!
Title: Re: What's the problem with parenthesis containing filenames?
Post by: AmigaMance on August 03, 2006, 06:05:27 PM
Quote
I guess you are not familiar with amigados wildcard syntax?

 Wrong guess.. I just want to know why this happens.
Title: Re: What's the problem with parenthesis containing filenames?
Post by: Karlos on August 03, 2006, 06:07:31 PM
Quote

AmigaMance wrote:
Quote
I guess you are not familiar with amigados wildcard syntax?

 Wrong guess.


Then you should know (see earlier post) that brackets are used by the wildcard system and need to be escaped if you are using them in filenames, which of course you shouldn't because they are reserved for the wildcard system :-P
Title: Re: What's the problem with parenthesis containing filenames?
Post by: Ilwrath on August 03, 2006, 06:11:35 PM
Quote
Then you should know (see earlier post) that brackets are used by the wildcard system and need to be escaped if you are using them in filenames


Alternately, you could just put the path/filename in quotes, as well.  :-)

But, of course, for the sake of sanity...  DON'T USE THE RESERVED CHARACTERS!   :-D
Title: Re: What's the problem with parenthesis containing filenames?
Post by: AmigaMance on August 03, 2006, 06:11:51 PM
@karlos
 Oh, i see now. Thanks, i wasn't that familiar with wildcards.
Title: Re: What's the problem with parenthesis containing filenames?
Post by: AmigaMance on August 03, 2006, 06:18:05 PM
@Ilwrath

 I just tried to use quotes but it doesn't work. so, yeah, it's better not to use reserved characters. In fact i never use them. I got the filenames from the internet.
Title: Re: What's the problem with parenthesis containing filenames?
Post by: Karlos on August 03, 2006, 06:25:18 PM
If you think amigados wildcards are harsh, you'd love RegEx syntax :-D
Title: Re: What's the problem with parenthesis containing filenames?
Post by: xeron on August 03, 2006, 07:33:20 PM
As karlos said, though, you can still manipulate the files using the apostrophe, IE:

rename file_'(with_brackets').txt file_without_brackets.txt
Title: Re: What's the problem with parenthesis containing filenames?
Post by: meega on August 03, 2006, 09:32:39 PM
Maybe off-topic a little, but I like to pattern match on ~(*.*) in script files. It works a treat.
Title: Re: What's the problem with parenthesis containing filenames?
Post by: AmigaMance on August 03, 2006, 09:49:05 PM
Quote
As karlos said, though, you can still manipulate the files using the apostrophe, IE:

rename file_'(with_brackets').txt file_without_brackets.txt

 Oh, right. This works. :-)