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
Read Only Archives
Cloverleaf
Cloverleaf
SFTP with WinSCP
System
Originally posted by Carl Duff
Does anyone have a UPoC that calls WinSCP (and passes parameters) that they would be willing to share?
Thanks in advance for any assistance.
Carl
Find more posts tagged with
Clovertech
Comments
System
Originally posted by garry r fisher
Hi Carl,
Rather than pass parameters, use the scripting option with WinSCP. I have over 30 (very simple) interfaces that use WinSCP to SFTP files to various systems using this method to generate scripts on the fly from a Tclproc.
This is how I do it:
# Write script
echo "Writing script file for $systm ($envir $systm)"
set ofh [open $script w]
puts $ofh "# Automatically answer all prompts negatively not to stall"
puts $ofh "# the script on errors"
puts $ofh "option batch on"
puts $ofh "# Disable overwrite confirmations that conflict with the previous"
puts $ofh "option confirm off"
puts $ofh "lcd "D:/interfaces/to oeo/$envir/$systm/inbound/""
puts $ofh "# connect using session"
puts $ofh "open server"
puts $ofh "# Force binary mode transfer"
puts $ofh "option transfer binary"
puts $ofh "# Download file to the local directory"
foreach fname $files {
set fname [file tail $fname]
puts $ofh "put $fname "./to oeo/$envir/$systm/inbound/$fname""
}
puts $ofh "# Disconnect"
puts $ofh "close"
puts $ofh "# Exit WinSCP"
puts $ofh "exit"
close $ofh
# Call WinSCP
echo "Calling WinSCP [clock format [clock scan seconds] -format %d/%m/%Y:%H:%M]"
if {[catch {exec winscp.com /script=$systm.txt} errmsg]} {
echo "There was a problem with the SFTP connection ($errmsg)"
The 'open server' command simply opens a connection to a saved WinSCP session called server.
One thing to watch out for is getting winscp.com on the correct path in Cloverleaf.
Regards
Garry