Saturday, September 24, 2016

find / cpio directory copy / move / archive info




http://bradthemad.org/tech/notes/cpio_directory.php

Create a cpio archive:
localhost% find path/ -depth -print | cpio -oaV > archive.cpio
localhost% find path/ -depth -print | cpio -oaV -O archive.cpio
Create 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.cpio
List the contents of a cpio archive:
localhost% cpio -it < archive.cpio
localhost% cpio -it -I archive.cpio
Use 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 
 
 

xx

No comments:

Post a Comment