Mount and merge folder contents

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












Is there any way to mount a folder content inside to another one?



Let's say I have 2 folders with following content;



Folder1 Folder2
file1 file2


I basically want to make visible all of the content of Folder2 in Folder1. So the new content should be like this;



Folder1 Folder2
file1 file2
file2


And I also want Folder1 content to be updated when I do any change in Folder2. Let's say I've created file3 in Folder2. I'm expecting to see the new file under both of them.



Folder1 Folder2
file1 file2
file2 file3
file3


So the general rules should be;



  • If you create/delete/modify any file under Folder2, it will be also visible under Folder1.

  • If you create/delete/modify any file in Folder 1 (which belongs to Folder2, for example removing file2), those changes will be done in Folder2.

  • User should not see any content of Folder1 under Folder2.

Any solution for that kind of requirement?



Thanks.







share|improve this question



















  • Why would one want to do this? It looks messy.
    – dr01
    May 3 at 13:42











  • For upstart conf files. I want to keep /etc/init tidy, so if I can do it, Folder1 will be /etc/init, and Folder2 will be my own service file folder which can reside anywhere in the system.
    – benjamin button
    May 3 at 14:01














up vote
0
down vote

favorite












Is there any way to mount a folder content inside to another one?



Let's say I have 2 folders with following content;



Folder1 Folder2
file1 file2


I basically want to make visible all of the content of Folder2 in Folder1. So the new content should be like this;



Folder1 Folder2
file1 file2
file2


And I also want Folder1 content to be updated when I do any change in Folder2. Let's say I've created file3 in Folder2. I'm expecting to see the new file under both of them.



Folder1 Folder2
file1 file2
file2 file3
file3


So the general rules should be;



  • If you create/delete/modify any file under Folder2, it will be also visible under Folder1.

  • If you create/delete/modify any file in Folder 1 (which belongs to Folder2, for example removing file2), those changes will be done in Folder2.

  • User should not see any content of Folder1 under Folder2.

Any solution for that kind of requirement?



Thanks.







share|improve this question



















  • Why would one want to do this? It looks messy.
    – dr01
    May 3 at 13:42











  • For upstart conf files. I want to keep /etc/init tidy, so if I can do it, Folder1 will be /etc/init, and Folder2 will be my own service file folder which can reside anywhere in the system.
    – benjamin button
    May 3 at 14:01












up vote
0
down vote

favorite









up vote
0
down vote

favorite











Is there any way to mount a folder content inside to another one?



Let's say I have 2 folders with following content;



Folder1 Folder2
file1 file2


I basically want to make visible all of the content of Folder2 in Folder1. So the new content should be like this;



Folder1 Folder2
file1 file2
file2


And I also want Folder1 content to be updated when I do any change in Folder2. Let's say I've created file3 in Folder2. I'm expecting to see the new file under both of them.



Folder1 Folder2
file1 file2
file2 file3
file3


So the general rules should be;



  • If you create/delete/modify any file under Folder2, it will be also visible under Folder1.

  • If you create/delete/modify any file in Folder 1 (which belongs to Folder2, for example removing file2), those changes will be done in Folder2.

  • User should not see any content of Folder1 under Folder2.

Any solution for that kind of requirement?



Thanks.







share|improve this question











Is there any way to mount a folder content inside to another one?



Let's say I have 2 folders with following content;



Folder1 Folder2
file1 file2


I basically want to make visible all of the content of Folder2 in Folder1. So the new content should be like this;



Folder1 Folder2
file1 file2
file2


And I also want Folder1 content to be updated when I do any change in Folder2. Let's say I've created file3 in Folder2. I'm expecting to see the new file under both of them.



Folder1 Folder2
file1 file2
file2 file3
file3


So the general rules should be;



  • If you create/delete/modify any file under Folder2, it will be also visible under Folder1.

  • If you create/delete/modify any file in Folder 1 (which belongs to Folder2, for example removing file2), those changes will be done in Folder2.

  • User should not see any content of Folder1 under Folder2.

Any solution for that kind of requirement?



Thanks.









share|improve this question










share|improve this question




share|improve this question









asked May 3 at 13:28









benjamin button

85




85











  • Why would one want to do this? It looks messy.
    – dr01
    May 3 at 13:42











  • For upstart conf files. I want to keep /etc/init tidy, so if I can do it, Folder1 will be /etc/init, and Folder2 will be my own service file folder which can reside anywhere in the system.
    – benjamin button
    May 3 at 14:01
















  • Why would one want to do this? It looks messy.
    – dr01
    May 3 at 13:42











  • For upstart conf files. I want to keep /etc/init tidy, so if I can do it, Folder1 will be /etc/init, and Folder2 will be my own service file folder which can reside anywhere in the system.
    – benjamin button
    May 3 at 14:01















Why would one want to do this? It looks messy.
– dr01
May 3 at 13:42





Why would one want to do this? It looks messy.
– dr01
May 3 at 13:42













For upstart conf files. I want to keep /etc/init tidy, so if I can do it, Folder1 will be /etc/init, and Folder2 will be my own service file folder which can reside anywhere in the system.
– benjamin button
May 3 at 14:01




For upstart conf files. I want to keep /etc/init tidy, so if I can do it, Folder1 will be /etc/init, and Folder2 will be my own service file folder which can reside anywhere in the system.
– benjamin button
May 3 at 14:01










1 Answer
1






active

oldest

votes

















up vote
0
down vote













I'm not aware of anyway to directly do what you're asking, and you would of course encounter issues if file1 existed in both folder1 and folder2.



You could create links from each file/directory under folder2 to folder1, this would require a link per file/directory under folder2. You could create a script to keep the links updated and remove dead links.



If you used hard links then this would all be seamless when doing a directory listing etc.



You could then use inotify to watch folder1 and folder2 to trigger the creation/deletion of the hard links.






share|improve this answer





















  • Creating another controller service is what I'm trying to escape, such as writing script. If I can mount the content of the folder2 into the folder1, and make it permanent, then there won't be any necessity to create a control mechanism.
    – benjamin button
    May 4 at 10:33










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441554%2fmount-and-merge-folder-contents%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













I'm not aware of anyway to directly do what you're asking, and you would of course encounter issues if file1 existed in both folder1 and folder2.



You could create links from each file/directory under folder2 to folder1, this would require a link per file/directory under folder2. You could create a script to keep the links updated and remove dead links.



If you used hard links then this would all be seamless when doing a directory listing etc.



You could then use inotify to watch folder1 and folder2 to trigger the creation/deletion of the hard links.






share|improve this answer





















  • Creating another controller service is what I'm trying to escape, such as writing script. If I can mount the content of the folder2 into the folder1, and make it permanent, then there won't be any necessity to create a control mechanism.
    – benjamin button
    May 4 at 10:33














up vote
0
down vote













I'm not aware of anyway to directly do what you're asking, and you would of course encounter issues if file1 existed in both folder1 and folder2.



You could create links from each file/directory under folder2 to folder1, this would require a link per file/directory under folder2. You could create a script to keep the links updated and remove dead links.



If you used hard links then this would all be seamless when doing a directory listing etc.



You could then use inotify to watch folder1 and folder2 to trigger the creation/deletion of the hard links.






share|improve this answer





















  • Creating another controller service is what I'm trying to escape, such as writing script. If I can mount the content of the folder2 into the folder1, and make it permanent, then there won't be any necessity to create a control mechanism.
    – benjamin button
    May 4 at 10:33












up vote
0
down vote










up vote
0
down vote









I'm not aware of anyway to directly do what you're asking, and you would of course encounter issues if file1 existed in both folder1 and folder2.



You could create links from each file/directory under folder2 to folder1, this would require a link per file/directory under folder2. You could create a script to keep the links updated and remove dead links.



If you used hard links then this would all be seamless when doing a directory listing etc.



You could then use inotify to watch folder1 and folder2 to trigger the creation/deletion of the hard links.






share|improve this answer













I'm not aware of anyway to directly do what you're asking, and you would of course encounter issues if file1 existed in both folder1 and folder2.



You could create links from each file/directory under folder2 to folder1, this would require a link per file/directory under folder2. You could create a script to keep the links updated and remove dead links.



If you used hard links then this would all be seamless when doing a directory listing etc.



You could then use inotify to watch folder1 and folder2 to trigger the creation/deletion of the hard links.







share|improve this answer













share|improve this answer



share|improve this answer











answered May 3 at 14:51









rusty shackleford

1,145115




1,145115











  • Creating another controller service is what I'm trying to escape, such as writing script. If I can mount the content of the folder2 into the folder1, and make it permanent, then there won't be any necessity to create a control mechanism.
    – benjamin button
    May 4 at 10:33
















  • Creating another controller service is what I'm trying to escape, such as writing script. If I can mount the content of the folder2 into the folder1, and make it permanent, then there won't be any necessity to create a control mechanism.
    – benjamin button
    May 4 at 10:33















Creating another controller service is what I'm trying to escape, such as writing script. If I can mount the content of the folder2 into the folder1, and make it permanent, then there won't be any necessity to create a control mechanism.
– benjamin button
May 4 at 10:33




Creating another controller service is what I'm trying to escape, such as writing script. If I can mount the content of the folder2 into the folder1, and make it permanent, then there won't be any necessity to create a control mechanism.
– benjamin button
May 4 at 10:33












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441554%2fmount-and-merge-folder-contents%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?