infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Cloverleaf
SFTP Server File Backup to Subfolder After Deletion by Cloverleaf Interface
David Ma
We have a SFTP interface in Cloverleaf that deletes files from the SFTP server after they are processed. We need to back up these files to a folder on the SFTP server so that other teams can access them.
Does anyone have any ideas—or perhaps a TCL script—that could perform this task?
Thanks!
David
Find more posts tagged with
Clovertech
Comments
Jim Kosloskey
One way I can think of is to route the messages to the OB side of the thread (or another sftp thread) pointing the OB side to the directory where you want the archive/backup to exist. I think the metadata will contain the file name but you may need to provide the directory path.
Ramachandran R
Dear David,
We use the following code snippet that will be used as inbound TPS to backup/archive in FTP and SFTP. You may need to pass backup/archive directory of SFTP server. Kindly review the code snippt, and let me know if any clarifications needed.
# Extract the message ID from the incoming message arguments
keylget args MSGID mh
# Retrieve the raw message data using the message handle
set data [msgget $mh]
# Extract DRIVERCTL metadata from the message
set Filekeys [msgmetaget $mh DRIVERCTL]
# Get the file path from the DRIVERCTL metadata
keylget Filekeys FILENAME FilePath
# Get the backup directory path from the incoming arguments
keylget args ARGS.BKUPDIR bkupDir
# Extract the filename from the full file path (get the last element after '/')
set Filename [lindex [split $FilePath /] end]
# Create a copy of the original message to modify and send back
set new_mh [msgcopy $mh]
# Prepare the output directory and file name for the outgoing message
keylset fileKeys OBDIR $bkupDir
keylset fileKeys OBFILE $Filename
# Wrap the fileKeys in a FILESET structure as required by Cloverleaf metadata format
keylset filesetKeys FILESET $fileKeys
# Set the updated DRIVERCTL metadata on the copied message
msgmetaset $new_mh DRIVERCTL $filesetKeys
# Continue processing the incoming message and send the modified message back
# as an acknowledgment that the file was fetched successfully
return "{CONTINUE $mh} {OVER $new_mh}"