cpio(1) cpio(1)NAME cpio - copy files to or from a cpio archive SYNOPSIS cpio -o[acBFv] cpio -i[BcdmrtuvfsSb6] [patterns] cpio -p[adlmuv] directory DESCRIPTION cpio -o (copy out) reads the standard input to obtain a list of pathnames and copies those files onto the standard output together with pathname and status information. The list of pathnames must contain only one file per line. (Thus, only certain commands, such as find or ls without the -C option, will work in a pipeline to cpio.) Output is padded to a 512-byte boundary. When cpio -o prints a message xxx blocks, it indicates how many blocks were written. cpio -i (copy in) extracts files from the standard input, which is assumed to be the product of a previous cpio -o. Only files with names that match patterns are selected. patterns are given in the name-generating notation of sh(1). In patterns, the meta-characters ?, *, and [...] match the slash / character. Multiple patterns may be specified but if none are, the default for patterns is * (that is, select all files). The extracted files are conditionally created and copied into the current directory tree based on the flag options described later. The permissions of the files will be those of the previous cpio -o. The owner and group as- signed to the files will be that of the current user unless the user is superuser, which causes cpio to retain the owner and group assigned to the files from the previous cpio -o. When cpio -i prints a message xxx blocks, it indicates how many blocks were read from the collection. cpio -p (pass) reads the standard input to obtain a list of pathnames of files that are conditionally created and copied into the destination directory tree based on the flag op- tions described later. When cpio -p prints a message xxx blocks, it indicates how many blocks were written. cpio does not follow symbolic links. The meanings of the available flag options are a Resets access times of input files after they have been copied. B Input/output is to be blocked 5,120 bytes to the record (does not apply to the pass flag option; meaningful only with data directed to or from 3.5- inch disks). d directories are to be created as needed. April, 1990 1
cpio(1) cpio(1)c Writes header information in ASCII character form for portability. r Interactively rename files. If the user types a null line, the file is skipped. t Prints a table of contents of the input. No files are created. u Copies unconditionally (normally, an older file will not replace a newer file with the same name). v verbose: Causes a list of filenames to be printed. When used with the t flag option, the table of con- tents looks like the output of an ls -l command (see ls(1)). l Whenever possible, links files rather than copying them. Usable only with the -p flag option. m Retains previous file-modification time. This flag option is ineffective on directories that are being copied. f Copies in all files except those in patterns. F When used with the -o flag and when the output dev- ice is a Macintosh II floppy drive, the F flag will cause each floppy to be formatted after it is in- serted into the drive. This formatting is for 800K drives only, so only 800K floppy disk should be used. s Swaps bytes. Use only with the -i flag option. S Swaps halfwords. Use only with the -i flag option. b Swaps both bytes and halfwords. Use only with the -i flag option. 6 Processes an old (that is, UNIX System Sixth Edition format) file. Useful only with -i flag option. EXAMPLES The pipeline ls | cpio -o > /dev/rdsk/c8d0s0 copies the contents of a directory into an archive. cd olddir find . -depth -print | cpio -pdl newdir duplicates a directory hierarchy. The simple case find . -depth -print | cpio -oB > /dev/rdsk/c8d0s0 may be handled more efficiently by: find . -cpio /dev/rdsk/c8d0s0 2 April, 1990
cpio(1) cpio(1)FILES /bin/cpio SEE ALSO ar(1), dd(1), find(1), ls(1), tar(1), cpio(4). BUGS Pathnames are restricted to 128 characters. If there are too many uniquely linked files, the program runs out of the memory needed to keep track of them and, thereafter, linking information is lost. Only the superuser may copy special files. April, 1990 3