expandargs(1) General Commands Manual expandargs(1)
NAME
expandargs - Expand wildcards in arguments and run a program
SYNOPSIS
expandargs <command or options> arguments...
DESCRIPTION
Expandargs is a Python script that can be used to expand filename wild-
card arguments on Windows when they are too complex for the filename
expansion that is built in to programs (if any). It can also be used
to produce a file with the expanded arguments in a simple list or in a
form suitable for use with the -filein option to Newstack. The lat-
ter may be useful on non-Windows systems, but there the argument list
would need to be quoted to have it expanded by this script instead of
by the shell. The script is run in one of three ways:
expandargs command arguments...
or
expandargs -o outputFile arguments...
or
expandargs -o outputFile -s sectionList arguments...
In the first form, the arguments will be expanded and the command will
be run with those arguments. In the second form, the filenames will be
placed into the given output file, one per line. In the third, the
output file will have the following format, which can be supplied to
the -filein option to Newstack:
# of files
filename1
sectionList
filename2
sectionList
...
The same section list will be put in the file for each line. If the arguments
specify a set of single-image files, simply use "-s 0". The "-s"
argument can also be put before the "-o" entry.
The filenames can contain constructs like:
* matching any set of characters
? matching any one character
[acg] matching any one of a, c, or g
[a-g] matching any letter from a to g
[^acg] matching any one character except a, c, or g
[^a-g] matching any one character except one from a to g
These wild cards can occur multiple times, in different directories of
a path. For example "[^t]*/*[0-9][0-9][0-9].mrc" will match all files
ending in three digits and ".mrc" in any directory except ones starting
with "t".
Many IMOD programs will do wild card expansion in Windows for filenames
entered as non-option arguments (ones without an option, typically
entered at the end of the command). However, this works only with "*"
and "?", and multiple expansions in different directory components of
the path (such as occur in that last example) will work only for Python
scripts. This internal expansion in Windows occurs automatically for
programs that take input with the PIP package, although few programs
actually handle multiple input fles. Other programs with this capabil-
ity are 3dmod, clip, imodinfo, imodjoin, imodmesh, and
tif2mrc.
AUTHOR
David Mastronarde, mast at colorado dot edu
IMOD 5.2.6 expandargs(1)