Newbie Question: Shell-like Scripting in Python?

Cameron Laird claird at
Wed Oct 2 14:15:29 CEST 2002

In article <5Oxm9.200485$pX1.7225080 at>,
Alex Martelli  <aleax at> wrote:
>Michael Stenner wrote:
>        ...
>>>   rename foo.* bar.*
>        ...
>> The only troublesome thing I see here is that "foo.*" is going to be
>> expanded by the shell (I think this is true for dos also) before your
>No, neither COMMAND.COM (good old DOS and Win/95 - /98) nor CMD.EXE
>(Win/NT, /2000, /XP) perform wildcard expansions.  You can of course
>link your own compiled programs with a library that will perform such
>expansion (C compilers for DOS often used to supply a file called
>argexpand.c or the like for this purpose), but Python is not thus
>linked in any pre-built Python distribution I ever heard of, nor are
>there any requests for such linking in the standard source distro.
Many times, people *want* DOS-hosted utilities to
expand wild cards.  As you write, argexpand is one
way to go about that.

It's far from the only one.  Alex knows this, of
course, but I want to make it explicit for other
readers.  If you're writing a DOS-hosted utility,
think about what you want
or other wildcards to mean.  While base Python
doesn't directly support their expansion, it's
easy enough to use glob and helpers.

Cameron Laird <Cameron at>

More information about the Python-list mailing list