gtpo1m5t | Operations |
Use this command to find files in a specified directory or directory hierarchy.
Requirements and Restrictions
Format
|
zfile find . \( -name tmp.* -o -name "*.t" \) -exec rm {} \;
first finds all files named tmp and all files with a .t extension. Those files are then passed to the ZFILE rm command (rm) and are subsequently removed.
Additional Information
ZFILE HELP find
ZFILE HELP
ZFILE ?
ZFILE ls -l | grep JanThe result is filtered output from the ZFILE ls command displaying only the lines containing the word Jan in any position.
You can use pipes only with a combination of ZFILE commands where the command on the left-hand side of the pipe provides data through stdout and the right-hand side accepts data through stdin.
You can redirect the standard output (stdout) stream from the display terminal to a file by specifying one of the redirection characters (> or >>) followed by the file name to which you want the output written. The > character writes the output to a file. The >> character appends the output to an existing file.
You can redirect the standard error (stderr) stream from the display terminal to a file by specifying one of the redirection characters (2> or 2>>) followed by the file name to which you want the error output written. The 2> character writes the error output to a file. The 2>> character appends the error output to an existing file.
User: ZFILE echo \$PATH is $PATH System: $PATH is /bin:/usr/bin:.
left angle bracket (<) | right angle bracket (>) | ampersand (&) |
backquote (`) | backslash (\) | dollar sign ($) |
double quotation mark (") | new-line (\n) | left parenthesis ( ( ) |
right parenthesis ( ) ) | semicolon (;) | single quotation mark (') |
blank space | tab | vertical bar (|) |
asterisk (*) | equal sign (=) | left square bracket ( [ ) |
number sign (#) | question mark (?) | tilde (~) |
Examples
The following example finds files with extensions .c and .h in or below your current directory.
+--------------------------------------------------------------------------------+ |User: ZFILE find ./ -name '*.[ch]' | | | |System: FILE0001I 08:14:31 START OF DISPLAY FROM find ./ -name '*.[ch]' | | ./abc.h | | ./file1.c | | ./file2.c | | ./xyz.h | | END OF DISPLAY | | | +--------------------------------------------------------------------------------+
The following example finds all directories in or below your current directory.
+--------------------------------------------------------------------------------+ |User: ZFILE find . -type d | | | |System: FILE0001I 08:14:31 START OF DISPLAY FROM find . -type d | | ./directory1 | | ./directory1/test | | ./directory2 | | END OF DISPLAY | | | +--------------------------------------------------------------------------------+
The following example finds file names that contain the string qzz and are owned by user bill in directory work.
+---------------------------------------------------------------------------------------------+ |User: ZFILE find work -name "qzz*" -user bill | | | |System: FILE0001I 08:14:31 START OF DISPLAY FROM find work -name "qzz*" -user ... | | work/apache/src/qzz1.c | | work/temp/qzz8.c | | END OF DISPLAY | | | +---------------------------------------------------------------------------------------------+
The following example displays the names of all files with the name tmp or with the .xx extension in or below the current directory.
+---------------------------------------------------------------------------------------------+ |User: ZFILE find . -name "tmp.*" -o -name "*.xx" | | | |System: FILE0001I 08:14:31 START OF DISPLAY FROM find . -name tmp -o -name "*.xx" | | ./file1.xx | | ./tmp.c | | ./tmp.t | | END OF DISPLAY | | | +---------------------------------------------------------------------------------------------+
The following example displays file names with access permission bit settings 777 (read, write, and execute permission for user, group, and other) in or below the current directory.
+---------------------------------------------------------------------------------------------+ |User: ZFILE find . -perm 777 | | | |System: FILE0001I 08:14:31 START OF DISPLAY FROM find . -perm 777 | | ./file1.c | | ./file2.c | | ./newdir/test.c | | END OF DISPLAY | +---------------------------------------------------------------------------------------------+
The following example removes all files named tmp or files ending in .xx in or below the current directory.
+---------------------------------------------------------------------------------------------+ |User: ZFILE find . \( -name "tmp.*" -o -name "*.xx" \) -exec rm {} \; | | | |System: FILE0001I 08:14:31 find . \( -... COMPLETED SUCCESSFULLY. NO OUTPUT TO DISPLAY | +---------------------------------------------------------------------------------------------+
The following example displays file names that do not end in .o or .t and are owned by user bill or are part of group pgrms in or below the current directory.
+---------------------------------------------------------------------------------------------+ |User: ZFILE find . ! \( -name "*.o" -o -name "*.t" \) -a \( -user bill -o -group pgrms \) | | | |System: FILE0001I 08:14:31 START OF DISPLAY FROM find . ! \( -name "*.o" -o -name "... | | ./abc.c | | ./newdir/new.c | | ./test2.c | | END OF DISPLAY | +---------------------------------------------------------------------------------------------+
Related Information