Use this command to remove a link to a file or a directory from the file
system.
Requirements and Restrictions
- The parameters for this command are case-sensitive. You
must enter the parameters exactly as shown in the syntax
diagram.
- You can enter this command only in CRAS state or higher.
- A directory must be empty before it can be removed unless you specify the
-r or -R parameter.
Format
- -f
- forces the removal of the specified file or directory regardless of the
access permissions that are set.
- Note:
- This parameter does not override the access permissions for a parent
directory; that is, if the access permissions for the parent directory of
the specified file do not allow write authority, the -f parameter is ignored
and the specified file will not be removed.
- -r
- recursively removes the specified file or directory. If you specify
a directory, all files and subdirectories under that directory are
removed. (This parameter is equivalent to the -R parameter.)
- -R
- recursively removes the specified file or directory. If you specify
a directory, all files and subdirectories under that directory are
removed. (This parameter is equivalent to the -r parameter.)
- path
- is the path name of the file or directory that you are removing from the
file system.
Additional Information
- Online help information is available for this command. To display
the help information, enter one of the following:
ZFILE HELP rm
ZFILE HELP
ZFILE ?
In addition, the correct command syntax is displayed if you enter the syntax
incorrectly.
- If you specify more than one parameter, you can specify these parameters
separately or together. For example, you can enter one of the
following:
- ZFILE rm -f -r path
- ZFILE rm -fr path
- You can remove directories as well as other files. The directory
that you are removing must be empty unless you specify the -r or -R
parameter.
- You can also use the ZFILE rmdir command to remove directories
- Removing a file is not necessarily the same as deleting a file; a
link to a file is actually removed. A file can have multiple links and
is not actually deleted until its final link is removed.
- You can redirect the standard input (stdin) stream from the
keyboard to a file by specifying the redirection character (<)
followed by the file name from which you want the input read.
This command does not write to the standard output (stdout)
stream.
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.
- Note:
- When you use the > or 2> character, if the file that
you are redirecting data to already exists, the file is overwritten and any
data in that file is lost. If you do not want to overwrite the file,
ensure that you use the >> or 2>> character.
- The ZFILE rm command is based on a subset of the rm utility of the
Portable Operating System Interface for Computer Environments (POSIX)
standards.
- You can use the following wildcard characters in the path name to select
files that satisfy a particular name pattern:
- Wildcard
- Description
- *
- Matches any string, including the empty string.
- ?
- Matches any single character.
- [..]
- Matches any one of the characters between the brackets. You can
specify a range of characters by separating a pair of characters with a dash
(-).
- This command supports the following three quoting mechanisms, which allow
you to override the special meaning of some characters:
- escape character (\)
- preserves the literal value of the character that follows. To
ignore the special meaning of a character, escape it by placing a backslash
(\) in front of it. In the example that follows, environment
variable PATH is /bin:/usr/bin:., the first
dollar sign ($) is escaped because of the preceding backslash, and the
second dollar sign takes on a special meaning.
User: ZFILE echo \$PATH is $PATH
System: $PATH is /bin:/usr/bin:.
- single quotation marks (' ')
- preserves the literal value of all characters between the opening single
quotation mark and the closing single quotation mark. For example,
entering ZFILE echo '*' displays an asterisk
character (*). Without the single quotation marks, the files
in the current working directory are displayed.
- double quotation marks (" ")
- preserves the literal value of all characters between the opening double
quotation mark and the closing double quotation mark except the dollar sign
($), the backquote (`), and the backslash (\).
This allows you to use the escape character inside double quotation marks,
which you cannot do in single quotation marks.
For example, entering ZFILE echo "\$PATH is \"$PATH\""
displays $PATH is "/bin:/usr/bin:."
If you want to use the literal meaning of any of the following
characters, you must always use a quoting mechanism:
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 (|)
|
In addition, use a quoting mechanism when any of the following characters are
used in a way that takes on a special meaning but you want to use the literal
meaning:
asterisk (*)
| equal sign (=)
| left square bracket ( [ )
|
number sign (#)
| question mark (?)
| tilde (~)
|
Examples
The following example removes a file.
+---------------------------------------------------------------------------------------------+
|User: ZFILE rm my.file |
| |
|System: FILE0003I 13.12.45 rm my.file COMPLETED SUCCESSFULLY. NO OUTPUT TO DISPLAY |
+---------------------------------------------------------------------------------------------+
The following example removes a directory and recursively removes any files
or subdirectories contained in the directory.
+---------------------------------------------------------------------------------------------+
|User: ZFILE rm -rf my.directory |
| |
|System: FILE0003I 15.10.13 rm -rf my.d... COMPLETED SUCCESSFULLY. NO OUTPUT TO DISPLAY |
+---------------------------------------------------------------------------------------------+
Related Information