Copying files using cpio - why do I get an "Invalid cross-device link" error?

876 Views Asked by At

For copying large files, I would like to try replacing in my shell scripts cp by cpio, because I hope to be able to fine-tune the performance by specifying explicit buffer sizes. The current development environment is Zsh on Cygwin on Windows 7, but by solution should also run on Linux.

My original copy command is

cp //some.share/some/file local_dir

I replaced it by

cpio -null -pd local_dir <<<//some.share/some/file

and I get the error message

//some.share/some/file: Invalid cross-device link

This surprises me. Why does cpio attempt to create a hard link here? After all, it is supposed to copy the file, not link to it!

I'm aware that I'm misusing cpio somewhat, in that cpio is supposed to copy archives, not individual files, but from my understanding of the -p command line switch, I thought that I could use it also for just copying files.

0

There are 0 best solutions below