Create a union of two directories, while writing to only it's own original directory

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











up vote
0
down vote

favorite












I want to create a union of two directories and when I move a file within the union'd folder, I want it to stay on the folder it originates from(See below).



How would I accomplish this? I have tried unionfs, but it will always follow the folder order, for example, if I mount a RW folder in the first spot, all writes will go to that folder, I want the following behavior, as described below:



I want to have 2 RW folders and a union-ed folder



RW - driveA
RW - driveB
Unioned - mergeDrive


Basically, when I do a file move (I can only touch the files through the mergeDrive, I want each file to be moved within there own folder.



So for example,



mv /mnt/mergeDrive/subFolderA/fileA.csv /mnt/mergeDrive/subFolderB/fileA.csv


FileA's original path:



/mnt/driveA/subFolderA/fileA.csv


Expected path after move:



/mnt/driveA/subFolderB/fileA.csv


Then I want to be able to do:



mv /mnt/mergeDrive/subFolderA/fileB.csv /mnt/mergeDrive/subFolderB/fileB.csv


FileB's original path:



/mnt/driveB/subFolderA/fileB.csv


Expected path after move:



/mnt/driveB/subFolderB/fileB.csv


So where ever the root folder of the file originates from, it stays in that root folder when being moved, even though it is moved through /mergeDrive/. Can you setup unionfs(or something similar) to do this?







share|improve this question
























    up vote
    0
    down vote

    favorite












    I want to create a union of two directories and when I move a file within the union'd folder, I want it to stay on the folder it originates from(See below).



    How would I accomplish this? I have tried unionfs, but it will always follow the folder order, for example, if I mount a RW folder in the first spot, all writes will go to that folder, I want the following behavior, as described below:



    I want to have 2 RW folders and a union-ed folder



    RW - driveA
    RW - driveB
    Unioned - mergeDrive


    Basically, when I do a file move (I can only touch the files through the mergeDrive, I want each file to be moved within there own folder.



    So for example,



    mv /mnt/mergeDrive/subFolderA/fileA.csv /mnt/mergeDrive/subFolderB/fileA.csv


    FileA's original path:



    /mnt/driveA/subFolderA/fileA.csv


    Expected path after move:



    /mnt/driveA/subFolderB/fileA.csv


    Then I want to be able to do:



    mv /mnt/mergeDrive/subFolderA/fileB.csv /mnt/mergeDrive/subFolderB/fileB.csv


    FileB's original path:



    /mnt/driveB/subFolderA/fileB.csv


    Expected path after move:



    /mnt/driveB/subFolderB/fileB.csv


    So where ever the root folder of the file originates from, it stays in that root folder when being moved, even though it is moved through /mergeDrive/. Can you setup unionfs(or something similar) to do this?







    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I want to create a union of two directories and when I move a file within the union'd folder, I want it to stay on the folder it originates from(See below).



      How would I accomplish this? I have tried unionfs, but it will always follow the folder order, for example, if I mount a RW folder in the first spot, all writes will go to that folder, I want the following behavior, as described below:



      I want to have 2 RW folders and a union-ed folder



      RW - driveA
      RW - driveB
      Unioned - mergeDrive


      Basically, when I do a file move (I can only touch the files through the mergeDrive, I want each file to be moved within there own folder.



      So for example,



      mv /mnt/mergeDrive/subFolderA/fileA.csv /mnt/mergeDrive/subFolderB/fileA.csv


      FileA's original path:



      /mnt/driveA/subFolderA/fileA.csv


      Expected path after move:



      /mnt/driveA/subFolderB/fileA.csv


      Then I want to be able to do:



      mv /mnt/mergeDrive/subFolderA/fileB.csv /mnt/mergeDrive/subFolderB/fileB.csv


      FileB's original path:



      /mnt/driveB/subFolderA/fileB.csv


      Expected path after move:



      /mnt/driveB/subFolderB/fileB.csv


      So where ever the root folder of the file originates from, it stays in that root folder when being moved, even though it is moved through /mergeDrive/. Can you setup unionfs(or something similar) to do this?







      share|improve this question












      I want to create a union of two directories and when I move a file within the union'd folder, I want it to stay on the folder it originates from(See below).



      How would I accomplish this? I have tried unionfs, but it will always follow the folder order, for example, if I mount a RW folder in the first spot, all writes will go to that folder, I want the following behavior, as described below:



      I want to have 2 RW folders and a union-ed folder



      RW - driveA
      RW - driveB
      Unioned - mergeDrive


      Basically, when I do a file move (I can only touch the files through the mergeDrive, I want each file to be moved within there own folder.



      So for example,



      mv /mnt/mergeDrive/subFolderA/fileA.csv /mnt/mergeDrive/subFolderB/fileA.csv


      FileA's original path:



      /mnt/driveA/subFolderA/fileA.csv


      Expected path after move:



      /mnt/driveA/subFolderB/fileA.csv


      Then I want to be able to do:



      mv /mnt/mergeDrive/subFolderA/fileB.csv /mnt/mergeDrive/subFolderB/fileB.csv


      FileB's original path:



      /mnt/driveB/subFolderA/fileB.csv


      Expected path after move:



      /mnt/driveB/subFolderB/fileB.csv


      So where ever the root folder of the file originates from, it stays in that root folder when being moved, even though it is moved through /mergeDrive/. Can you setup unionfs(or something similar) to do this?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 21:39









      asdasd2a43qaad

      11




      11

























          active

          oldest

          votes











          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%2f433328%2fcreate-a-union-of-two-directories-while-writing-to-only-its-own-original-direc%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes










           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433328%2fcreate-a-union-of-two-directories-while-writing-to-only-its-own-original-direc%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)