1

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 = "sftp@33.113.250.45:/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
msanford
  • 11,803
  • 11
  • 66
  • 93
Razz
  • 71
  • 6
  • 1
    This error is from `pscp`. Perhaps this will be useful, see especially the update to the question (you're using PoSH 4, which is very old, so I wonder if the putty you are running is also old): https://unix.stackexchange.com/questions/27419/how-to-use-wildcards-when-copying-with-scp – msanford Dec 08 '21 at 03:51
  • 1
    Does it work if you use hard-coded values instead of variables? – Santiago Squarzon Dec 08 '21 at 03:51
  • Also, double-check the case. *NIX filesystems are often case sensitive, so `file.Xlsx` and `file.xlsx` would be two different things. – vonPryz Dec 08 '21 at 06:39

0 Answers0