LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to symlink - not copy - an entire directory structure? (https://www.linuxquestions.org/questions/linux-software-2/how-to-symlink-not-copy-an-entire-directory-structure-4175646996/)

lucmove 01-26-2019 08:37 AM

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?

TIA

dc.901 01-26-2019 10:38 AM

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.

lucmove 01-26-2019 11:33 AM

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.

How can I do that with find?

fatmac 01-26-2019 12:27 PM

Try ln -s dirname Where


All times are GMT -5. The time now is 03:40 AM.