My account has been setup on a SFTP Server where my home directory is set as root to a particular landing folder. My issue is in the script using
$RemotePath = "/Home/username"
this is not what it should be, I'm sure. I've tried using all listed below as the $remotePath, but still not working.
Please advise on what my
should be if on the SFTP Server the home directory is set
PS D:\temp> D:\Scripts\HCM_Dowload.ps1
Exception calling "ListDirectory" with "1" argument(s): "Error listing directory 'sftp://sftp.******.com'.
General failure (server should provide error description).
Error code: 4
Error message from server: Folder not found: /sftp://sftp.******.com/
Common reasons for the Error code 4 are:
- Renaming a file to a name of already existing file.
- Creating a directory that already exists.
- Moving a remote file to a different filesystem (HDD).
- Uploading a file to a full filesystem (HDD).
- Exceeding a user disk quota."
At D:\Scripts\HCM_Dowload.ps1:44 char:9
+ $directoryInfo = $session.ListDirectory($remotePath)
+ CategoryInfo : NotSpecified: (:) , MethodInvocationException
+ FullyQualifiedErrorId : SessionRemoteException
catch : The term 'catch' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At D:\Scripts\HCM_Dowload.ps1:71 char:1
+ CategoryInfo : ObjectNotFound: (catch:String) , CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Write-Host "Error: $($_.Exception.Message)"