Archival
If you wanted to archive an entire directory tree, the find command can provide the file list to cpio:
% find . -depth -print cpio -ov > tree.cpio
Copy
Cpio copies files from one directory tree to another, combining the copy-out and copy-in steps without actually using an archive. It reads the list of files to copy from the standard input; the directory into which it will copy them is given as a non-option argument.
% find . -depth -print0 cpio --null -pvd new-dir
Extraction
To extract files from a cpio archive, pass the archive to cpio as its standard input.
Warning: This will overwrite without prompting.
% cpio -id < cpiofile
The -i flag indicates that cpio is reading in the archive to extract files, and the -d flag tells cpio to construct directories as necessary. You can also use the -v flag to have file names listed as files are extracted.
Any non-option command line arguments are shell-like globbing-patterns; only files in the archive whose names match one or more of those patterns are copied from the archive. The following example extracts etc/fstab from the archive (the format of the archive contents should be verified with `cpio -l` first to verify how path is stored) :
% cpio -id etc/fstab < cpiofile
Hiç yorum yok:
Yorum Gönder