Showing posts with label cpio. Show all posts
Showing posts with label cpio. Show all posts
Wednesday, January 15, 2020
stream extract of cpio archive
extract cpio archive, split into parts.
create archive with split command, reassemble into stream with cat of all of parts in order.
example
cat usr-cpio-* | cpio -idv
cat usr-cpio-* assembles all parts into a stream
use pipe to cpio | cpio
cpio options -idv
-i means cpio put into reading mode, w/o other input option, will default to stdin
stdin driven by cat command pipped to the cpio invocation.
-d create directories, and recurse.
-v verbose report to stdout (stdout for a -i instance is either silent, or verbose list of files
--30--
Saturday, September 24, 2016
find / cpio directory copy / move / archive info
http://bradthemad.org/tech/notes/cpio_directory.php
https://www.computerhope.com/unix/ucpio.htm
Create a cpio archive:
localhost% find path/ -depth -print | cpio -oaV > archive.cpio localhost% find path/ -depth -print | cpio -oaV -O archive.cpioCreate a cpio archive and compress it:
localhost% find path/ -depth -print | cpio -oaV | gzip -c > archive.cpio.gz
Extract a compressed cpio archive:
cd to parent directory of location to install.
gzip -cd path-to-cpio-gz | cpio -idmv
<uncompress to stdout> pipe <cpio install stream from stdin>
http://superuser.com/questions/31078/cpio-basic-extract-command-tar-xzvf-equivalent
Extract a cpio archive:
localhost% cpio -imVd < archive.cpio localhost% cpio -imVd -I archive.cpioList the contents of a cpio archive:
localhost% cpio -it < archive.cpio localhost% cpio -it -I archive.cpioUse cpio copy-pass to copy a directory structure to another location:
localhost% find path/ -depth -print | cpio -pamVd /new/parent/dir
cpio over ssh
To cpio a local directory, send the output to ssh and feed it to cpio on a remote host:localhost% find path/ -depth -print | cpio -oaV | ssh user@host 'cpio -imVd'Ssh to a remote host, cpio a remote directory, and get its output locally:
localhost% ssh user@host "find path/ -depth -print | cpio -oaV" | cpio -imVd
**************
Another reference
https://docs.oracle.com/cd/E23824_01/html/821-1459/bkupsavefiles-21.html
- Change to the appropriate directory.
# cd filesystem1
- Copy the directory tree from filesystem1 to filesystem2 by using a combination of the
find and cpio commands.
# find . -print -depth | cpio -pdm filesystem2
- .
- Starts in the current working directory.
- Prints the file names.
- -depth
- Descends the directory hierarchy and prints file names from the bottom up.
- -p
- Creates a list of files.
- -d
- Creates directories as needed.
- -m
- Sets the correct modification times on directories.
The files from the directory name you specify are copied. The symbolic links are preserved.
You might also specify the -u option. This option forces an unconditional copy. Otherwise, older files do not replace newer files. This option might be useful if you want an exact copy of a directory, and some of the files being copied might already exist in the target directory.
xx
Subscribe to:
Posts (Atom)