Let's say I have the following directory hierarchy
|/home
| |/john
| | |/app
| | | |/folder1
| | | | |/data1.dat
| | | | |/...
| | | |/folder2
| | | | |/...
| | | |/cfg
| | | | |/settings.cfg
| | | | |/...
| | | |/start.sh
| |/deer <-- I'm here
| | |/app
I need to symlink (for space reasons) all the files under /home/john/app excluded the files under /home/john/app/cfg (they are customized for each user) in /home/deer/app while preserving the subdirectories tree inside the app folder.
How can I achieve this? I tried already using a combination of rsync
(to recreate the subfolders tree) and find
(to list the files without the ones in cfg), however I am having difficulties telling ln
to create the symlinks inside the correct subfolders.
rsync -a -f"+ */" -f"- *" /home/john/app/ app/
find /home/john/app/* -type f -exec ln -s '{}' app/ \; # I'm stuck here
Thanks in advance.