When using PutFile can you specify send the files in the order they where created?

Advertisement

graham_jones@...
Guest

When using PutFile can you specify send the files in the order they where created?

I am transferring files to a remote folder using
$transferresult = $session.putfiles("y:\ackn\Soc.xml", "./folder", $false, $transferoptions)
Is there a way of ensuring the files are transferred in the order that they were created on the y:\ackn folder?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
38,408
Location:
Prague, Czechia

Re: When using PutFile can you specify send the files in the order they where created?

WinSCP cannot do it for your automatically, but it's easy to implement it in PowerShell:
$fileList = Get-ChildItem "y:\ackn" | Sort-Object LastWriteTime
foreach ($localFile in $fileList)
{
    Write-Host "Uploading $($localFile.FullName)..."
    $session.PutFileToDirectory($localFile.FullName, "./folder")
}
(untested)

Reply with quote

Advertisement

You can post new topics in this forum