Here's my code:
#!/usr/local/bin/expect -f
set timeout 800
spawn sftp $env(SSH_USER)@$env(SSH_HOST) port(22)
expect {
default {exit 2}
"continue connecting (yes/no)?" {send "yes\n"; exp_continue}
"assword:" {send "$env(SSH_PASS)\n"; exp_continue}
"sftp>"
}
send "get /$env(SSH_FILE) /navient/$env(SSH_FILE_IMP)\r"
expect {
default {exit 2}
"not found" {exit 3}
"sftp>"
I want to get files file the server; but, I'm trying to use a wildcard(*) for the files in a directory.
So the value for $env(SSH_File) is: Inbox/MathewsOutbound_20240305*.CSV
The actual file name on the server is: "MathewsOutbound_20240305hhmmss.csv"
The date and time will vary. I'm okay with the date; but, I wouldn't know what time the file was created.
I would appreciate any input. Thanks.
Roger
I listed all information above.