Background Processing

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Daniel0312
Posts: 154
Joined: 15 Feb 2016 10:48

Background Processing

Post 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
2021-05-26_120617.png (5.75 KiB) Viewed 450 times
There must be something I misundertand in this background processing thing, can anybody explain?

Thanks.
Daniel
Windows7 SP1 x64 / XY latest stable

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Background Processing

Post 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...
One of my scripts helped you out? Please donate via Paypal

Daniel0312
Posts: 154
Joined: 15 Feb 2016 10:48

Re: Background Processing

Post by Daniel0312 »

HI highend,
Thanks for the explanation and the tip.
It works like a charm !
Daniel
Windows7 SP1 x64 / XY latest stable

Post Reply