A problem with a script :\

Advertisement

YairGOW
Joined:
Posts:
6

A problem with a script :\

Hey.

I have a script that will automatically download all new files from a certain directory on my server. I run this script every 5 minutes, so sometimes it happens that while transferring one file(let's call this file 'file A'), more files will appear in this directory, and it seems that if the filenames of the new files are alphabettically prior to that of the file that is already transferring, the script will simultaneously download two files on two different sessions if the download wasn't completed in the 5 minutes window between running the scrip again(file A and a new file that has appeared in the folder - file B - will be downloaded in two different sessions). The problem is that when that happens, if file A has been completely transferred, the script will transfer it again from the second session after the transfer of file B is done. That is to say, it won't recognize that it's already fully transferred file A and will start the download of file A from scratch.

My question is, will there might be a way to avoid this kind of situation? Is there maybe a way to limit WinSCP to connect to only one session at a time from a certain server, so the script won't connect twice to the server, thus preventing the simultaneous downloads.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,468
Location:
Prague, Czechia

Re: A problem with a script :\

If you are using Windows Scheduler, you can set it not to run second instance, if previous is still running.

Reply with quote

Advertisement

You can post new topics in this forum