How to symlink - not copy - an entire directory structure?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to symlink - not copy - an entire directory structure?
I would like to do just what rsync is meant to do, ie copy an entire and rather complex directory structure into another existing complex directory structure, but just symlinking everything rather than actually copying it. I checked rsync's manual and it doesn't seem that rsync can do that. Is there any easy way I can achieve this?
If you create a symbolic link at the top level directory, is that not enough?
Otherwise, this can be a maintenance nightmare when a new file/directory is created you will have to find and create links for them also. And, same for when a file/directory is deleted, you have to find and clean up the links.
Perhaps I am not understanding your requirement, and perhaps you should explain why this is needed?
---
If you absolutely wish to do this, one way I can think of is with find command.
Sometimes I need to have certain files in more than one place. It helps me find what I want. One thing I've done before is just copying everything then having fslint detect duplicates and hardlink them, to save space. But that always takes quite a while. If I could just symlink it, it would be instantaneous.
I don't believe the "maintenance nightmare" you refer to is going to be an issue.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.