What\'s the simplest way on Linux to \"copy\" a directory hierarchy so that a new hierarchy of directories are created while all \"files\" are just symlinks pointing back to
If you feel like getting your hands dirty Here is a trick that will automatically create the destination folder, subfolders and symlink all files recursively.
In the folder where the files you want to symlink and sub folders are:
create a file shell.sh:
nano shell.sh
#!/bin/bash
export DESTINATION=/your/destination/folder/
export TARGET=/your/target/folder/
find . -type d -print0 | xargs -0 bash -c 'for DIR in "$@";
do
echo "${DESTINATION}${DIR}"
mkdir -p "${DESTINATION}${DIR}"
done' -
find . -type f -print0 | xargs -0 bash -c 'for file in "$@";
do
ln -s "${TARGET}${file}" "${DESTINATION}${file}"
done' -
ctrl+Octrl+XMake your script executable chmod 777 shell.sh
Run your script ./shell.sh
Happy hacking!