[NTLUG:Discuss] Re: cpio -- echo|cpio -p (it usually takes a piped list of filenames)

Bryan J. Smith b.j.smith at ieee.org
Fri Nov 26 11:12:44 CST 2004


On Fri, 2004-11-26 at 10:03, Fred wrote:
> I am trying to copy an encrypted file from one directory tree
> to another and cp fails with an i/o error. (yes, the file is
> ok) I thought that cpio in pass through mode would work, but
> I can't seem to get the syntax right. I am running SuSE 9.1
> pro.
> "cpio -puv  <[source filename]" 
> How do I make it work?

Try:  
  echo "[source filename]" | cpio -puv [target filename]

The passthru mode takes a _list_ of paths/filenames (pipe stdin "|"),
not actual contents (redirect stdin "<").

Two other options to consider:  
  -d  Make paths as necessary (if the source path has leading dirs)
  -m  Preserve modification time (and permissions on some platforms)


Patrick R. Michaud wrote:  
> Ummm, assuming that you did mean "cp" here,

No, by "passthru" he can only mean to use the "cpio" command.

> I can't imagine any situation where cp(1) would fail that cpio(1)
> would then be able to resolve it.

On Linux, there are only a few details "cp" don't do with recursive,
dereference and a couple of other options.  But I've still been able to
"dork it up" if I start copying socket, device and other special nodes.

In a nutshell, learning to wield find|cpio, echo|cpio, cat|cpio, etc...
is very powerful.  And it is very _universal_ across UNIX platforms.

> The cp(1) command doesn't care (or know) if the file is encrypted or
> not...as far as it's concerned, it's just a stream of bytes.

As with cpio too.

> Are you getting something more descriptive than "i/o error"?

That's a typical error for improper syntax with cpio.  Right now he's
passing the _contents_ of his redirected input (<) as various filenames.
That's why Copy I/O is barfing with an "i/o error."

> How large is the file being copied?

Yes, this could be an issue with some utilities.

> Did you try copying the file into somewhere such as /var/tmp or /tmp
> to see if that would work?
> How about copying the file into the same directory under a different
> name?

Or just check permissions on the target directory with:  
  touch [target filename]


-- 
Bryan J. Smith                                    b.j.smith at ieee.org 
-------------------------------------------------------------------- 
Subtotal Cost of Ownership (SCO) for Windows being less than Linux
Total Cost of Ownership (TCO) assumes experts for the former, costly
retraining for the latter, omitted "software assurance" costs in 
compatible desktop OS/apps for the former, no free/legacy reuse for
latter, and no basic security, patch or downtime comparison at all.





More information about the Discuss mailing list