OL Learn

XML Index file with multiple ZIPs

Hi

I have a job where I get a XML trigger file and several ZIP files. Within the XML file it lists all the ZIP files. What’s the best way to validate that I have all the ZIP files listed in the XML file? Is it to create a javascript or is there a easier way?

You could do this without a script, but it won’t be easier.

You’d have to branch out of the main trunk, split your XML file, and for each item listed, run a Folder Listing set to use the path/filename as a mask. The resulting XML tells you the number of files it found (along with information on each file) so you could do a quick compare against the File count node to see if it’s equal to 1.

I’m pretty certain, however, that querying the OS via FileSytemObject is going to be more efficient than all of that. If you’re comfortable with either jscript or vbscript, I’d recommend simply going that route.

Actually, you could use one of Version 2020.1’s new features: the File/Folder Condition task.
Basically, you use your XML file as the data file and you either split it into nodes or create metadata where each node is a “document” (that way, you can use the metadata sequencer, which is more efficient than splitting files when the file is a large one).

After that, it’s just a question of using the File/Folder condition task and setting the name of the file to check using a standard data selection.

Huh, neat. Missed that addition. That does make things easier.

Here’s a sample process illustrating how I used the metadata sequencer along with the File/Folder condition:
image
I used a sample XML file that has the following structure, but of course you can use pretty much any structure:

<? xml version="1.0" ?>
<files>
   <file>C:\tests\File1.zip</file>
   <file>C:\tests\File1.zip</file>
   <file>C:\tests\DoesNotExist.zip</file>
</files>

In each branch of the condition, you should add whatever actions are appropriate to handle the results.

damn we don’t have the new version but looks a lot easier with that!

Well you should update your version, then! :slight_smile:

yeah I’m trying but out of my hands at the moment :smiley: