Re: Upload 2 Files with different names (no wildcards)
My question is: Is there a way to upload these two files in one step, something like
Why? What do you expect from that?
My question is: Is there a way to upload these two files in one step, something like
[...]
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
$transferResult = $session.PutFiles("C:\PathTo\Export.csv", "Export$(Get-Date -format yyMMddhhmm).csv", $False, $transferOptions)
$transferResult.Check()
$transferResult = $session.PutFiles("C:\PathTo\Hash.txt", "Hash$(Get-Date -format yyMMddhhmm).txt", $False, $transferOptions)
$transferResult.Check()
[...]
[...]
$files2upload = @("C:\PathTo\Export.csv", "C:\PathTo\Hash.txt")
$renamedFiles = @()
foreach($file2upload in $files2upload)
{
$fileInfo = [io.FileInfo] $file2upload
$renamedFiles += ("{0}{1}{2}" -f $fileInfo.BaseName, $(Get-Date -format yyMMddhhmm), $fileInfo.Extension)
}
$transferResult = $session.PutFiles($files2Upload, $renamedFiles, $False, $transferOptions)
[...]