cancel
Showing results for 
Search instead for 
Did you mean: 

Shell scripting for tracing a file in FTP server.

Former Member
0 Kudos

Hi All,

Please help me find a solution for the following requirement:

We have a requirement for a SAP PI interface where we receive an XML file from Unix system once a day. PI picks the file from Unix FTP server and makes a proxy call to SAP ECC. This script will run before PI channel polls the directory. The script should check if there are any files in the specified location. If there is, it does nothing. If there are no files, It should send an E-mail notification stating that SAP has not received any files on that particular day. The script required is in shell script format.

Thanks in Advance,

Sreedhar

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sreedhar

Run this from cron once a day to check the directory set in the varable DIR and set the <emailaddress> too


#!/bin/bash
DIR="/usr/sap/trans"

if [ "$(ls -A $DIR)" ]; then
     # there are files, so do nothing
else
    echo "SAP has not received any files on " `date` |mailx -s "FTP file check"  <emailaddress>
fi