Files downloaded too fast
Hi,
I have a problem with a PowerShell script that is downloading files from FTP folder to a local folder. Our customer is first creating a txt file on the FTP folder and then write the data into it. It's a way how their software works. It's probably only milliseconds before the data is written into the file.
Most of the time the downloaded files are ok but sometimes data is missing and we even got files of 0kb.
I think my PowerShell script is downloading the files too fast in that case.
Is the a way to put in a delay so when a new file is put on the FTP it waits for a sec before downloading the file?
Here is the script that I use:
I have a problem with a PowerShell script that is downloading files from FTP folder to a local folder. Our customer is first creating a txt file on the FTP folder and then write the data into it. It's a way how their software works. It's probably only milliseconds before the data is written into the file.
Most of the time the downloaded files are ok but sometimes data is missing and we even got files of 0kb.
I think my PowerShell script is downloading the files too fast in that case.
Is the a way to put in a delay so when a new file is put on the FTP it waits for a sec before downloading the file?
Here is the script that I use:
$sessionOptions.AddRawSettings("FSProtocol", "2") $session = New-Object WinSCP.Session try { # Connect $session.Open($sessionOptions) # Transfer files $session.GetFiles("DataFolder/Spoolfiles/*", "D:\Spoolfiles\*", $True).Check() Write-Output "LOOKING FOR DATA.." } finally { $session.Dispose() }