Upload file if exists (filename changes daily)
Hi All
Im using powershell to upload a file if it exists, its a daily file with the date appended to the filename:
here is a snippit from the log:
how do I get it to get the attributes of the file?
Thanks in advance
Im using powershell to upload a file if it exists, its a daily file with the date appended to the filename:
# Logging $session.SessionLogPath = $log # Connect Write-Host "Connecting to DCK FTP..." $session.Open($sessionOptions) # Retrieve filename from local path $localFile = Get-ChildItem $localPath -Filter $task*.zip | % { $_.FullName } if ($session.FileExists($localFile)) { # Upload $session.PutFiles($localFile, $remotePath).Check() exit 0 } else { Write-Host "Local Test file does not exist" exit 1 }
here is a snippit from the log:
> 2020-06-11 16:43:45.658 Script: stat -- "\\layafsp3\InspireFtp\Testing110620.zip"
. 2020-06-11 16:43:45.658 Listing file "\\layafsp3\InspireFtp\Testing110620.zip".
> 2020-06-11 16:43:45.658 Type: SSH_FXP_LSTAT, Size: 73, Number: 263
< 2020-06-11 16:43:45.674 Type: SSH_FXP_STATUS, Size: 32, Number: 263
< 2020-06-11 16:43:45.674 Status code: 2, Message: 263, Server: No such file., Language: en
< 2020-06-11 16:43:45.674 Script: Can't get attributes of file '\\layafsp3\InspireFtp\Testing110620.zip'.
< 2020-06-11 16:43:45.674 No such file or directory.
< 2020-06-11 16:43:45.674 Error code: 2
< 2020-06-11 16:43:45.674 Error message from server (en): No such file.
. 2020-06-11 16:43:45.674 Script: Failed
> 2020-06-11 16:43:45.721 Script: exit
. 2020-06-11 16:43:45.721 Script: Exit code: 1
. 2020-06-11 16:43:45.721 Closing connection.
. 2020-06-11 16:43:45.721 Sending special code: 12
. 2020-06-11 16:43:45.721 Sent EOF message
how do I get it to get the attributes of the file?
Thanks in advance