Page 1 of 1

Background Processing

Posted: 26 May 2021 12:13
by Daniel0312
Hi,

What I want to do is pretty straightforward : work on a file in a temporary folder, when done, copy it to a data folder, then delete the temp folder...
Something like this :

Code: Select all

copyto "D:\Data", "R:\TEMP\d_work\TestFile.txt";
delete 0,0,"R:\TEMP\d_work";
$FileName=listfolder("D:\Data");
echo $FileName; 
The result is an empty string: the file isn't copied but the temp foder is gone :(
The temp folder seems to be deleted before the file is copied.
It was working OK until I enabled Backgroung processing. It seemed a good idea.
2021-05-26_120617.png
There must be something I misundertand in this background processing thing, can anybody explain?

Thanks.

Re: Background Processing

Posted: 26 May 2021 12:28
by highend
copyto isn't a function, the script doesn't wait for the command to return but instead executes the next following one immediately...

Use
setting "BackgroundFileOps", 0;
before copyto

to turn background processing off and circumvent the problem.

If you don't want to do that you'd need a (following) loop to check if the file is already in its new place and break it to continue...

Re: Background Processing

Posted: 26 May 2021 12:49
by Daniel0312
HI highend,
Thanks for the explanation and the tip.
It works like a charm !