[lug] Moving Users

Aaron Crane aaron.crane at pobox.com
Mon Nov 20 18:01:47 MST 2000

Andrew Diederich <andrew at NETdelivery.com> writes:
> A popular way to move users' home dirs from /home to /newhome:
> find . -print | cpio -dumpv /newhome

Until some user creates a file whose name contains a newline, and then
complains at the admin staff for losing his data...

Fortunately, with GNU find and GNU cpio, the fix is simple:

    find . -print0 | cpio -dumpv0 /newhome

The -print0 option to find makes it terminate file names with a null
character (which cannot appear in file names), rather than a newline (which
can).  Then the -0 option to cpio persuades it to read its file list in that

Aaron Crane   <aaron.crane at pobox.com>   <URL:http://pobox.com/~aaronc/>

More information about the LUG mailing list