I am seeking for a command that would re-create a whole tree of files in a different directory. I would prefer to have all symlinks absolute. Can I do that with a find and xargs? ;-)
cp -rs source/ dest/
should do the trick. The directory structure will be recreated at dest/ with each file being a symlink to its counterpart in source.
-
Also my first attempt. Failed to get
cp
to create symlink forsource/some_deeper_dir/files
. – Jokester Apr 2 '13 at 16:29 -
3In my experience, you have to use the full path to source (e.g.
cp -Rs /home/myusername/source dest
) otherwise it will complain. here's a ref: lists.gnu.org/archive/html/help-gnu-utils/2004-08/msg00039.html – 22degrees Nov 3 '16 at 21:05
In case cp -rs
is not the answer you're looking for, lndir
might be the correct answer.
-
Handled perfectly deep subdirectories structures. Installed it on debian using
sudo apt-get install xutils-dev
– Guillaume Berche Sep 3 '19 at 12:29
/tmp/somedirectory
pointing at/home/me/somegreatdir
, then all the contents ofsomegreatdir
will be visible under/tmp/somedirectory
. This needs just one symlink for the entire tree. Or what else do you want? – jankes Nov 12 '11 at 23:41