Skip to Content
0
Former Member
Feb 26, 2007 at 08:47 PM

File receiver - Get file size

418 Views

Hi all,

In my scenario, the message mapping is such that the target message may or may not have child nodes created depending on certain conditions. I am using file receiver channel to write this target message as xml file on another server.

The issue I am facing is - suppose child nodes are not created, the target message has only root node, and nothing else. i.e. it is empty.

But still the file gets written on destination, because file adapter doesn't seem to have intelligence to look into the payload. So I have to manually delete such 'almost-empty' files.

Although PI 7.0 has feature of ignoring empty files, the file I am talking of is really not of 0 kb size, as it contains namespace and root node tag. It has very small size of 1 kb, this is fixed and thus the file is easily distinguished from other larger files which contain child nodes. File size is a parameter that can be certainly used as a key here, but don't know how.

Does anyone have any idea on -

1) How to check file size before file receiver adapter writes it,

2) How to prevent such file from getting written, or

3) run a script which can detect the file size and delete them periodically / or every time file receiver writes files ?

Regards,

- Shankar.