wildcard : Java Glossary
home W words local find no local find frame, full screen Google search web for topic jump to footer translate with Babelfish by Roedy Green ©1996-2008 Canadian Mind Products
Go to : punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all)
wildcard
In Windows BAT language you can refer to all files in a directory as *.html or all files a?.html for all two-letter files starting with a. The way you specify such a group of files is called a wildcard. * matches anystring. ? matches any single chararacter.

Oddly if you pass a wild card to any Java utility, the command processor expands the wildcards so that you program for *.* will see list of all the directories and all the files, one per arg[i] slot.

This was an dumb idea. If your program is designed to handle lists of files and directories, then *.* effectively asks it to process not only each file in the current directory, but each directory (and presumably all its files as well). It ends up processing one deep in the directory tree nest, where *.* normally just processes the files in the current directory.

In windows, you can subvert this expansion, by putting quotes around the wildcards, e.g. "*.html". In Linux, bash you can subvert the globbing with \ quoting, e.g. \*.html Then your program will get the command-line parameters unexpanded.

Experiment!

It is probably easier to understand this by experiment than by explanation. Here is a simple tool to help you.

CMP_homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.16] The information on this page is for non-military use only.
You are visitor number 5,436. Military use includes use by defence contractors.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/Mindprod website mirror)
http://mindprod.com/jgloss/wildcard.html J:\mindprod\jgloss\wildcard.html