Error while fetching the files from sftp server using powershell

234 Views Asked by At

I'm trying to get *.xlsx files from the sftp server folder "/From/Outbound/TEST" using putty. I know it's something to do with the source path. I tried the below but nothing is working. Please please help.

"$Source/*.xlsx"
'$Source/*.xlsx'

$Source = "[email protected]:/From/Outbound/TEST"
[string]$TransferResults = & 'C:\Program Files\PuTTY\pscp.exe' -l 'user' -pw 'password' $Source/*.xlsx  $Destination

I'm getting the below error:

pscp.exe : pscp: wildcard '*.xlsx' matched no files
At Test.ps1:29 char:31
+    [string]$TransferResults = & 'C:\Program Files\PuTTY\pscp.exe' -l 'user' - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (pscp: wildcard '*.xlsx' matched no files:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
0

There are 0 best solutions below