web stats
Unable to move a folder through file reader - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 09-28-2017, 04:52 AM
arpit arpit is offline
Mirth Newb
 
Join Date: Sep 2017
Posts: 11
arpit is on a distinguished road
Question 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.
Reply With Quote
  #2  
Old 09-28-2017, 08:24 AM
BCMirthUser BCMirthUser is offline
OBX.2 Kenobi
 
Join Date: May 2015
Posts: 93
BCMirthUser is on a distinguished road
Default

Did you deploy the channel after making the change?
Reply With Quote
  #3  
Old 09-28-2017, 10:49 AM
aTom aTom is offline
OBX.3 Kenobi
 
Join Date: Feb 2016
Location: Lake Geneva Area
Posts: 113
aTom is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 09-28-2017, 08:54 PM
arpit arpit is offline
Mirth Newb
 
Join Date: Sep 2017
Posts: 11
arpit is on a distinguished road
Default

Yes.
Channel is deployed but File Reader only reads file in that folder it doesn't create directory structure as source.
Reply With Quote
  #5  
Old 09-28-2017, 10:22 PM
arpit arpit is offline
Mirth Newb
 
Join Date: Sep 2017
Posts: 11
arpit is on a distinguished road
Default

Quote:
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.
Reply With Quote
  #6  
Old 09-29-2017, 12:43 AM
aTom aTom is offline
OBX.3 Kenobi
 
Join Date: Feb 2016
Location: Lake Geneva Area
Posts: 113
aTom is on a distinguished road
Default

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
Reply With Quote
  #7  
Old 09-29-2017, 01:56 AM
arpit arpit is offline
Mirth Newb
 
Join Date: Sep 2017
Posts: 11
arpit is on a distinguished road
Default

Quote:
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.
Reply With Quote
  #8  
Old 09-29-2017, 03:08 AM
aTom aTom is offline
OBX.3 Kenobi
 
Join Date: Feb 2016
Location: Lake Geneva Area
Posts: 113
aTom is on a distinguished road
Default

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
__________________
Tom

Last edited by aTom; 09-29-2017 at 03:11 AM.
Reply With Quote
  #9  
Old 10-01-2017, 12:32 PM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 168
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

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 : Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a call with me at https://integrations.as.me
Reply With Quote
Reply

Tags
file reader

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 09:56 PM.


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