Flowgear access to files on the local file system

121 Views Asked by At

I am creating a Flowgear workflow that needs to process a raft of XML data.

I have the xml data contained in a set of .xml files (approximately 400 files) in a folder on my local machine hard-drive and I want to read them into a workflow, run an XSLT transform and then write out the resultant XML to another folder on the same local hard-drive.

How do I get the flowgear workflow to read these files?

2

There are 2 best solutions below

1
On BEST ANSWER

It depends on the use case, the File Enumerator works exceptionally well to loop (as in for-each) through each file. Sometimes, one wants to get a list of files in a particular folder and check whether a file has been found or not. For this, I would recommend a c# script to get a list of files with code:

Directory.GetFiles(@"{FilePath}", "*.{extension}", SearchOption.TopDirectoryOnly);

Further on, use the File node to read, write, or delete files from a file directory.

NB! You will need to install a DropPoint on the PC/Server to allow access to the files. For more information regarding Drop Points, please click here

1
On

You can use a File Enumerator or File Watcher to read the files up. The difference is that a File Enumerator will enumerate all files in a folder once, the File Watcher will watch a folder indefinitely and provide new files to the workflow as they are copied into the folder.

You can then use the File node to write the files back the the file system.