Problem with Getfiles path incorrect when using powershell
I'm working on a simple download of specific files and I've run into this issue.
This works.
$session.GetFiles("/Extract/SCTM.xlsx","e:\File-Hold\").Check()
This Does not.
$SourceFile = "/Extract/SCTM.xlsx"
$TargetFolder = "e:\File-Hold\"
$session.GetFiles($SourceFile,$TargetFolder).Check()
The problem in the log seems to be that the path doesn't resolve as expected.
> 2013-06-12 11:37:10.120 Script: get -nopermissions -preservetime -transfer="binary" -- "/Extract/SCTM.xlsx e:\File-Hold\" ""
It seems to be adding the 2 paths together as a source file and setting the targetfolder to be blank.
I've tried a lot of different ideas to get the variable paths to work but always comes back incorrect in the logs giving error
Can't get attributes of file '/Extract/SCTM.xlsx e:\File-Hold\'.
Any idea's why this is happening. I'm running the code on a 2012 server running powershell 3.0.
This works.
$session.GetFiles("/Extract/SCTM.xlsx","e:\File-Hold\").Check()
This Does not.
$SourceFile = "/Extract/SCTM.xlsx"
$TargetFolder = "e:\File-Hold\"
$session.GetFiles($SourceFile,$TargetFolder).Check()
The problem in the log seems to be that the path doesn't resolve as expected.
> 2013-06-12 11:37:10.120 Script: get -nopermissions -preservetime -transfer="binary" -- "/Extract/SCTM.xlsx e:\File-Hold\" ""
It seems to be adding the 2 paths together as a source file and setting the targetfolder to be blank.
I've tried a lot of different ideas to get the variable paths to work but always comes back incorrect in the logs giving error
Can't get attributes of file '/Extract/SCTM.xlsx e:\File-Hold\'.
Any idea's why this is happening. I'm running the code on a 2012 server running powershell 3.0.