How to copy file preserving directory path in Linux?
The switch you need is –parents, e.g.: jim@prometheus:~$ cp –parents test/1/.moo test2/ jim@prometheus:~$ ls -la test2/ total 42 drwxr-xr-x 3 jim jim 72 2010-09-14 09:32 . drwxr-xr-x 356 jim jim 43136 2010-09-14 09:32 .. drwxr-xr-x 3 jim jim 72 2010-09-14 09:32 test jim@prometheus:~$ ls -la test2/test/1/.moo -rw-r–r– 1 jim jim 0 2010-09-14 09:32 test2/test/1/.moo