Recently I worked on one required where I want to download /send files to FTPS server, standard PI File adapter will not support implicit FTPS calls, so I decided to use OS commands (shell scripts) to achieve the same.
This is very common requirement where you want to perform Archiving, Logging and changing the file name using Shell script. If you have a prior experience executing scripts using PI, Logging is not possible, when ever we call script using communication channel it gives only stats message shell script is called or not in communication channel monitoring.
If any syntax error occurred or no files found in FTP server or any other exception occurrs it is very difficult to find the root cause, so if you perform logging then you can easily solve above issues.
Refer below wiki, it gives basic idea how to write and call OS commands in XI/PI.
If you see above image there was a scripting code where I am downloading files from FTPS server and putting in to local XI NFS.
Below statement will generate log file in FTP location with end to end status.
exec &> /usr/sap/interfaces/xd5ftp/xxxxxbank/EBS.log
Changing the File Name:
I want to add the time stamp to file before placing in to target directory, below two lines code required, time stamp format you can change whet ever format you want.
Below statement will download all files from source system and copies in to Target directory with time stamp.
get *,byparm $DSTFILE
If you want to archive the messages in FTP directory add below code in script, this will move files in to Archive directory.
# Archive directory
# Move transferred file to archive directory $ARCDIR
mv $File $ARCDIR