Copy From Archive File (CPYFRMARCF)
Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
The Copy From Archive File (CPYFRMARCF) command decompresses files and directories from an archive file. The archive file could have been created on an IBM i system by running the Copy To Archive File (CPYTOARCF) command or on another operating system by running any of the tools that can create an archive file.
Restrictions:
- You must have read (*R) authority to the archive file to be decompressed. You must also have *R authority to each directory in the path name preceding the file name.
- You must have write and execute (*WX) authority to the directory where the decompressed files will be written.
- The archive file must be in one of the following file systems: QOpenSys,"root", or a user-defined file system.
Top |
Parameters
Keyword | Description | Choices | Notes |
---|---|---|---|
FROMARCF | From archive file | Path name | Required, Positional 1 |
TODIR | To directory | Path name | Required, Positional 2 |
RPLDTA | Replace data | *NO, *YES | Optional |
Top |
From archive file (FROMARCF)
Specifies the archive file to be decompressed.
This is a required parameter.
- path-name
- Specify the path name for the archive file to be decompressed. Wildcard characters are not allowed in the path name. The file name can be an absolute name or a relative name (to the current working directory).
For more information on specifying path names, refer to "Object naming rules" in the CL topic collection in the Programming category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/.
Note: This parameter is Unicode-enabled. See "Unicode support in CL" in the CL topic collection in the Programming category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/ for additional information.
Top |
To directory (TODIR)
Specifies the directory where the decompressed files will be written.
This is a required parameter.
- path-name
- Specify the path name for the directory where the decompressed files will be written. If files in subdirectories were copied when the archive file was created, the files will be copied back to the same subdirectories. Wildcard characters are not allowed in the path name. The directory name can be an absolute name or a relative name (to the current working directory).
For more information on specifying path names, refer to "Object naming rules" in the CL topic collection in the Programming category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/.
Note: This parameter is Unicode-enabled. See "Unicode support in CL" in the CL topic collection in the Programming category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/ for additional information.
Top |
Replace data (RPLDTA)
Specifies whether or not to replace the data in existing files when decompressing the archive file.
- *NO
- If the archive file contains data for a file that already exists on the system, the existing file data is not replaced.
- *YES
- If the archive file contains data for a file that already exists on the system, the existing file data is replaced. Ownership and authorities for the existing file are not changed.
Top |
Examples
Example 1: Decompress an Archive File and Replace Existing Files in a Library
CPYFRMARCF FROMARCF('/MYDIR/MyArchiveFile.zip') TODIR('/QSYS.LIB/MYLIB.LIB/') RPLDTA(*YES)
This command will decompress the files in archive file MyArchiveFile.zip in directory MYDIR and replace the data for the existing files in library MYLIB. If a file in the archive does not already exist in library MYLIB, a database physical file is created and the user doing the decompress will be the file owner.
Example 2: Decompress an Archive File to a Directory Without Replacing Existing Files
CPYFRMARCF FROMARCF('/MYDIR/dir2archive.jar') TODIR('/dir1/dir2/') RPLDTA(*NO)
This command will decompress the files in archive file dir2archive.jar in directory MYDIR and write the data to files in directory dir2. If a file in the archive does not exist in directory dir2, it will be created and user doing the decompress will be given read, write, and execute (*RWX) authority to the file. If a file in the archive already exists in dir2, it will be skipped and the existing file data will not be replaced.
Top |
Error messages
*ESCAPE Messages
- CPFC807
- Parameter passed to decompress a file is not valid, reason code &1.
- CPFC808
- The size of the file &1 is greater than 4,294,967,295 bytes and cannot be decompressed.
- CPFC809
- The file &1 is corrupted and cannot be decompressed.
- CPFC810
- File &1 is encountered that is not suiltable for decompression. Decompression not completed.
- CPFC812
- Archive file not decompressed.
Top |