Announcement

Collapse
No announcement yet.

Unable to move a folder through file reader

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to move a folder through file reader

    Following is my source folder path:-


    Outer-->Inner(some files along with this folder)-->InnerMost(here also)--> a lots of .txt files

    So /home/me/Outer is my source.
    I want to move same folder structure to the destination.
    So I checked Include sub-directories to YES
    but still file is not moved to destination.

    But files with Outer folder is moved,it is not picking Outer folder.

  • #2
    Did you deploy the channel after making the change?

    Comment


    • #3
      Not sure if I understand what you want to do : you would like to pick up files from a source directory structure and copy / move them to a destination in the same folder structure, right?

      It's not working that way, Reader and Writer are totally independant from each other, and they're handling files, not folders. File Reader is able to browse a directory structure to pick files according to the pattern, but not "move" folders themself. And you can use File Writer connector to create a directory structure but you have to tell him how.

      There are several ways to do it, but all programmatically. For example you can determine dynamically the outgoing destination using $('originalFilename') Velocity variable, save it in a channelMap variable (say 'subDirectory') and apply it in your destination : /home/me/inner/$subDirectory.

      FilenameUtils class from Apache's commons library (included in Mirth) could help you for this.
      Tom

      Comment


      • #4
        Yes.
        Channel is deployed but File Reader only reads file in that folder it doesn't create directory structure as source.

        Comment


        • #5
          Originally posted by aTom View Post
          Not sure if I understand what you want to do : you would like to pick up files from a source directory structure and copy / move them to a destination in the same folder structure, right?

          It's not working that way, Reader and Writer are totally independant from each other, and they're handling files, not folders. File Reader is able to browse a directory structure to pick files according to the pattern, but not "move" folders themself. And you can use File Writer connector to create a directory structure but you have to tell him how.

          There are several ways to do it, but all programmatically. For example you can determine dynamically the outgoing destination using $('originalFilename') Velocity variable, save it in a channelMap variable (say 'subDirectory') and apply it in your destination : /home/me/inner/$subDirectory.

          FilenameUtils class from Apache's commons library (included in Mirth) could help you for this.

          Yes Tom, you get it right. I want to copy or move folders also.
          I checked 'yes' to Include Sub-directories but that also not digging into folder structure. Mirth is copying only files, that are present in source folder.
          Not in the sub-folders.

          Comment


          • #6
            What's the protocol used? file? And what's your post-process action?

            On destination side, as said, File Writer won't copy folder structure for you.

            Now on source side, it sounds like you may have a right issue on your disk. For testing purposes, are the files picked if you change the source directory to /home/me/outer/<yourSubDir>?
            Tom

            Comment


            • #7
              Originally posted by aTom View Post
              What's the protocol used? file? And what's your post-process action?

              On destination side, as said, File Writer won't copy folder structure for you.

              Now on source side, it sounds like you may have a right issue on your disk. For testing purposes, are the files picked if you change the source directory to /home/me/outer/<yourSubDir>?
              No, there is no 'right' related issue.All sub-folders have 777 rights.
              SFTP is the protocol I am using.
              You're right, File Writer won't copy folder structure.
              But it should copy files from sub-folders.

              Comment


              • #8
                If it's a connector issue I'm afraid I can't help further since I've never worked with sftp protocol. I would do further testing though, to ensure there is no other issue, like disabling any script or testing a different protocol or reading subdirectory directly.

                I came on following thread, about a different issue in an older Mirth version but discussion still seems interesting : http://www.mirthproject.org/communit...ad.php?t=12168
                Last edited by aTom; 09-29-2017, 03:11 AM.
                Tom

                Comment


                • #9
                  Due to the dynamic nested folder structure, you might not be able to use the built in File Reader. What about using a JavaScript reader to read the structure and set it as a variable to be able to write to the outer folder as well?

                  -= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
                  -= [email protected]
                  -= Mirth Connect (Advanced)-certified
                  -= Gold member of HL7.org
                  -= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines

                  Comment

                  Working...
                  X