Reputation: 9894
I have the core code, which is the same for all projects, except one configuration file. I can't symlink to that dir because, this assumes that the config file will be also symlinked.
Is there a way in Linux/Bash to do that? I thought to write a script which creates a usual directory, then symlinks all the contents (=files and dirs) from the core, and then, I can just create there the config file.
Not sure if that's the best solution however.
Upvotes: 1
Views: 936
Reputation: 9894
@Zsolt, thanks, with the help of your answer I could answer my own question.
find /your/project -maxdepth 1 ! -name "CONFIGFILE" -exec ln -s \{\} ./ \;
-maxdepth 1 makes sure the find command doesn't go recursive. Thus, symlinks can be created for the directories and for the files. In other words, for the directory contents Exactly what I needed. :)
Upvotes: 1
Reputation: 51693
mkdir someothersite && cd someothersite
find /your/project -type f ! -name 'CONFIGFILE' -exec ln -s \{\} ./ \;
Note this works well if there are no subdirectories in /your/project
directory. If there are subdirectories it's much more complicated.
By the way, I'd use a VS for this. E.g. central repo, checkout, setup config...
HTH
Upvotes: 6