cancel
Showing results for 
Search instead for 
Did you mean: 

Archiving Empty Flies in SFTP

former_member186851
Active Contributor
0 Kudos

Dear Scn User,

There is a option to archive faulty files in SFTP.

Is there a way to archive empty files in SFTP?

Only emply files should be archived,other files should be processed to proxy.

Accepted Solutions (1)

Accepted Solutions (1)

engswee
Active Contributor

Yup, you can use the option below:-

You can read up more about it in the following link. Basically "create no message" will allow you to perform deletion and archiving of an empty file.

Configuring the SFTP Sender Channel - SAP Process Integration, secure connectivity add-on Configurat...

former_member182412
Active Contributor
0 Kudos

Hi Eng,

I just tested this in my system the file only deleting from the directory but not archiving the file when we select the Process empty file parameter to Create no message.

@Raghu if the above option did not archive the message you can put XPath condition in receiver determination if the FileSize equal to zero then send the file to archive folder.

Regards,

Praveen.

engswee
Active Contributor
0 Kudos

Sorry I didn't elaborate further. Archiving still needs to be set in the Advanced tab "Archive Files of SFTP server".

Choosing the "Create no message" just allows the file to be treated "normally" with respect to subsequent deletion/archiving steps based on deletion/archiving config.

For the other two options:-

- Process Empty File - it will still perform deletion/archiving but an XI message is created with empty payload which I think is not what is wanted here

- Skip Empty File - the file is not processed at all and remains in the source folder (not picked, not deleted, not archived)

former_member182412
Active Contributor
0 Kudos

Hi Eng,

I selected Archive Files on SFTP server in the advanced tab and mention the archive directory but the file is not archiving it is just deleting the file from directory.

Regards,

Praveen.

engswee
Active Contributor
0 Kudos

Hi Praveen

Thanks for checking this out. I remember we had an interface in our system with requirement (archiving empty files) so I tried looking for it. It seems that interface does process empty files (not just ignore them) so the setting was "Process empty file" instead of "Create no message" as I mentioned above.

I tried testing with "Create no message" and have the same results as you - empty files were only deleted but not archived.

So possible options are:-

i) Set "Process empty file" and use conditions to route it to an archive folder (as mentioned by Praveen above)

ii) Set "Process empty file" and use adapter's archiving to archive the file. Use condition to route to proxy only if file size is not empty.

The drawback for both approach is that there is a limitation in using the condition editor. SFTP adapter stores the file size under attribute name FileSize (under a configurable namespace). However condition editor allows a fix set of context objects and expects it as shown below.

So the condition editor cannot be used in conjunction with the SFTP adapter.

Only other way I can think to get around this is to use an enhanced receiver determination instead. Not sure if this is worth doing just to achieve archiving of empty files. That is for Raghuraman to decide.

Regards

Eng Swee

former_member186851
Active Contributor
0 Kudos

Thanks Praveen and Engg,

Let me try out both the options.

Answers (1)

Answers (1)

abhijit_masih
Explorer
0 Kudos

HI Raghuraman,

This requirement can be met by run time OS command before message processing feature.

you can write simple script which can check check the length of file and move it to other directory if it is 0 size file.

Thanks,

Kunaal

engswee
Active Contributor
0 Kudos

IMHO, script would probably be a feasible solution if it was a File(NFS) adapter. But since this is an SFTP adapter, the files are on the SFTP server, so the script would need to written to execute connection to the server to perform SFTP commands. It just unnecessarily complicates the design.

In general, I would always avoid usage of scripts wherever possible. Execution of scripts are independent of the channel and do not provide visibility in terms of monitoring as any errors are not logged back to the adapter framework, thus possibly introducing a gap in terms of end to end monitoring.