STScI logoSTSDAS Help Pages
findfiles ctio findfiles

NAME · USAGE · PARAMETERS · DESCRIPTION · EXAMPLES · SEE_ALSO

NAME

findfiles -- Find files

USAGE

findfiles rootdir name

PARAMETERS

rootdir
Root directory name from where start the search. This directory and all its subdirectories will be traversed during the search.
name
File name template to match against the names of the files found. All metacharacters used for file name templates are supported.
type = "plain"
File type to match against the type of the files found. Possible file types are: none , plain , and directory , meaning any type of file, text or binary files, and directories, repectively.
print = yes
Print file names as files are found ?.
nflush = 10
Maximum number of files to store in the standard output buffer before printing them. This parameter may be set to a low value if the program is being used interactively, and to a high value if the output of the programm is being redirected to a file. The task runs faster with higher values. An INDEF value is traslated to the largest possible value.
execute = ""
Command to execute on every file that matches all the conditions imposed by the other parameters. It can be any command that the CL would accept. All ocurrences of the string "$file" in the command string will be replaced by the matching file.
wait = yes
Wait for command completion before proceding with the next matching file ?.
skip = yes
Skip hidden files ?.

DESCRIPTION

This task recursively descends the specified directory hierarchy seeking for files that match the conditions imposed by name , and type . There are two possible actions to take on every file matching the previous conditions: print its name and/or execute a CL command.
The following metacharacters are recognized by the task in the file name template to match against file names:


	*	Match zero or more characters, e.g. *.cl
	[...]	Any character in class, e.g. [a-z]
	[^...]	Any character no in class, e.g. [^A-Z]
	?	Match any single character, e.g. a?c
	{...}	Ignore case for enclosed string, e.g. {Lroff}

If no metacharacters are used a plain string comparison is used.

EXAMPLES

1.- Find all imaage header files in the user account, and print their names:


lo> findfiles home$ "*.imh" type=plain print+

2.- Find all subdirectories in the user account, and give a directory listing for each one:

lo> findfiles home$ "*" type=directory execute="dir $file"

3.- Delete all images in the user account, but prompting the user for confirmation (otherwise it would be very dangerous):

lo> findfiles home$ "*.imh" type=plain exec="imdelete $file ver+"

SEE ALSO

files, match


Source Code · Search Form · STSDAS

Maintained by the Science Software Group at STScI
This file last updated on 9 Apr 1990