Copying symbolic links but pointing to same files(copied) but different target base directories

421 Views Asked by At

I am trying to create a test environment by updating it with another test environment files. Heres my situation:

I have a directory SRC. It has directories "test_bundles" and "tools_bundles" which has all the required builds. Additionally, SRC has "latest" directory which has files "test_bundle_1", "tools_bundle_1" etc. which points to specific builds within directories "test_bundles" and "tools_bundles", i.e., symbolic links.

Now on a different Linux system, I have DEST directory which is regularly updated with contents of "test_bundles" and "tools_bundles" from the SRC directory. I also want to have "latest" directory in DEST that has same files as in "latest" within SRC directory, however, points to builds (these builds are same) inside "test_bundles" and "tools_bundles" within the DEST.

Note that files change their links to different builds and moreover, new files get added to "latest" within SRC as well. So whenever I do copy operation it should update everything.

I dont know what to call this. Am I trying to copy the SRC "latest" to DEST "latest" files (symbolic links) with links to different parent directory structure.

Note that my script is doing good by updating "test_bundles" and "tools_bundles". I just need a way for "latest" files with the test environment uses different base directories.

1

There are 1 best solutions below

0
On

If the links in latest are relative there is nothing special that needs to be done - parent directory names do not matter. – Michał Politowski

Actually its the opposite, the links are not relative rather the parent directory structure(tree) is different – user3685188

What Michał Politowski surely meant to suggest is that you should make the symbolic links relative in order to have your problem solved - and that is the most sane solution.