HFS: File masks: Difference between revisions
m (Reverted edits by 70.87.15.130 (Talk); changed back to last version by 213.88.128.199) |
No edit summary |
||
Line 2: | Line 2: | ||
A file mask denotes a set of files. It is something like this: <tt>*.jpg;*.gif</tt>. This example denotes any jpeg and gif files. | A file mask denotes a set of files. It is something like this: <tt>*.jpg;*.gif</tt>. This example denotes any jpeg and gif files. | ||
== How does it work? == | == How does it work? == |
Revision as of 15:12, 17 July 2006
What is it?
A file mask denotes a set of files. It is something like this: *.jpg;*.gif. This example denotes any jpeg and gif files.
How does it work?
The example above shows a double file mask. It has two atoms separated by the semicolon: *.jpg and *.gif. The semicolon is used to merge multiple masks: it is a special character. There are only 3 special characters in file masks: ; * and ?.
The star (*)
stands for any string of characters. If the mask contains only the star, it would match ANY file.
If you put an A before the star A*, it matches any file starting with an A.
If you put an A after the star *A, it matches any file ending with an A.
Moreover A*B matches any file starting with an A and ending with a B. In the example above, you find *.jpg : it matches any file ending with .jpg that is jpeg images. Well, know that jpeg files sometimes ends with .jpeg and rarely with .jpe .
The star matches also the null string: a*.jpg matches files like a1.jpg , adfgg.jpg but also a.jpg , where the star has been replaced with nothing.
The question mark (?)
stands for a single character. Something like A?B matches any 3 chars long filename, starting with an A and ending with a B. The length is fixed to 3 characters because ? can be replaced by only one single character. Thus the ? does not match the null string as the * does.