To change file system and still able to refer with same path from script

hi , currently I have two file structures like /ABCetl and /ABCDetl
plan is to make both these dir structure into one file system i.e
/MainDir/ABCetl
/MainDir/ABCDetl
all our script still using same path /ABCetl and /ABCDetl , so without modifying scripts how we can manage ?

Welcome!

You can use symbolic links:
/AFCetl -> /MainDir/ABCetl
/ABCDetl -> /MainDir/ABCetl

Do you really mean "file system" i.e. /MainDir is a mount point?
Then you can also use a bind mount: bind /ABCetl to /MainDir/ABCetl

Hello,

Welcome to the forum ! We hope you enjoy your time here, and find this to be a friendly and helpful place.

So, if I understand you correctly, you'll be going from a directory structure like this:

/ABCetl
/ABCDetl

to this:

/MainDir/ABCetl
/MainDir/ABCDetl

And the issue is that you have lots of scripts that use the original paths, and you don't want to have to update them to use the new paths.

If that's the case, then the solution here should be pretty straightforward - once the directories have been moved, create a symbolic link from the new directory location back to the old ones.

So once the changeover was complete, you'd just do:

# ln -s /MainDir/ABCetl /ABCetl
# ln -s /MainDir/ABCDetl/ /ABCDetl

And after you've done this, you'll be able to refer to the original paths via the symbolic links, and of course the new paths as well since that's the actual names of the directories:

# ls -ld /MainDir/* /ABC*
lrwxrwxrwx 1 root root   17 Sep 22 07:37 /ABCDetl -> /MainDir/ABCDetl/
lrwxrwxrwx 1 root root   15 Sep 22 07:37 /ABCetl -> /MainDir/ABCetl
drwxr-xr-x 2 root root 4096 Sep 22 07:37 /MainDir/ABCDetl
drwxr-xr-x 2 root root 4096 Sep 22 07:37 /MainDir/ABCetl
# cd /ABCetl
# pwd
/ABCetl
# cd /ABCDetl
# pwd
/ABCDetl
# 

Hope this helps ! If my understanding of the situation wasn't quite correct, or if you have any further questions, please let us know and we can take things from there.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.