Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   Unable to move a folder through file reader (http://www.mirthcorp.com/community/forums/showthread.php?t=217605)

arpit 09-28-2017 04:52 AM

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.
:(

BCMirthUser 09-28-2017 08:24 AM

Did you deploy the channel after making the change?

aTom 09-28-2017 10:49 AM

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.

arpit 09-28-2017 08:54 PM

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

arpit 09-28-2017 10:22 PM

Quote:

Originally Posted by aTom (Post 261159)
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.

aTom 09-29-2017 12:43 AM

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>?

arpit 09-29-2017 01:56 AM

Quote:

Originally Posted by aTom (Post 261162)
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.

aTom 09-29-2017 03:08 AM

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

jackwhaines 10-01-2017 12:32 PM

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?


All times are GMT -8. The time now is 09:55 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation