Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 07-20-2017 08:30 AM
I have a remote directory as an input (containing sub-directories) and i'd like to iterate for each subdirectory and check if a specific file exist, once the last exist i will ftp this sub-directory to local directory using Nifi.
could you please help me on this scenario.
Created on 07-27-2017 09:09 PM - edited 08-18-2019 12:42 AM
I am assuming you know how many subdirectories there are in this solution.
ListFTP - scanning the main directory with all the subdirectories
EexcutScript - running a groovy script waiting for all of the flag.ok files to be in the subdirectories
FetchFTP - configured to pull the wanted files
Here is a snapshot of the simple flow:
Here is the sample groovy script for the ExecuteScript processor, configured for this example to wait for 5 files:
def flowFiles = session.get(5)
if(!flowFiles || flowFiles.size() < 5) {
session.rollback()
} else {
session.transfer(flowFiles, REL_SUCCESS)
}
waiting-for-5-files-before-ftping-the-files.xml Here is a template of the sample flow
Created 07-25-2017 12:00 AM
Are you saying you want to wait until each sub-directory has a specific file and then start ftping the files to a local directory?
Created 07-26-2017 09:12 AM
@Wynner @Matt Clarke @Matt Burgess @Pierre Villard
I want to check each sub-directory once a specific file come like "flag.ok", i start ftping the files
of this sub-directory to a local directory() (always i need to loop all sub-directories
and doing the same job).
Thanks a lot for your support.
Created on 07-27-2017 09:09 PM - edited 08-18-2019 12:42 AM
I am assuming you know how many subdirectories there are in this solution.
ListFTP - scanning the main directory with all the subdirectories
EexcutScript - running a groovy script waiting for all of the flag.ok files to be in the subdirectories
FetchFTP - configured to pull the wanted files
Here is a snapshot of the simple flow:
Here is the sample groovy script for the ExecuteScript processor, configured for this example to wait for 5 files:
def flowFiles = session.get(5)
if(!flowFiles || flowFiles.size() < 5) {
session.rollback()
} else {
session.transfer(flowFiles, REL_SUCCESS)
}
waiting-for-5-files-before-ftping-the-files.xml Here is a template of the sample flow