12-04-21 12:55 PM
Hi,
I have a process where i download a couple of PDF´s from a legacy system to a folder.
After that, the files are being uploaded to an e-service via Web-API.
When i´m about to delete the files afterwards, i can´t since the files are being used...
I´m using the Delete Files from standard utility in BP.
The program that is "blocking" me from deleting the files is automate.exe so kill process is out of the question.
I do not modify the files or anything....
Thing is that is sometimes work, sometimes not, sometimes after 30 sec, sometimes after 10mins so it´s not consistent either.
I have tried all kinds of things with waits, using delete file each by each, delete all etc. etc. but not success.
Anyone encountered something similar or have any good pointers?
Thanks,
Karl
12-04-21 01:12 PM
12-04-21 01:27 PM
Hi @ewilson,
Thanks for the quick response.
Everything is within a single process but on separate sub-pages.
What would be your suggestion?
Run a codestage / specific action to force the .NET garbage collector to empty state?
Thanks,
Karl
12-04-21 01:47 PM
12-04-21 01:53 PM
12-04-21 02:09 PM
@ewilson
Files is printed as PDF and downloaded to a temp folder.
We are using "Get Files" to load the Collection from the Temp folder and the upload the via the Web API.
Update... 15:55
I did some test runs and removed the Upload Sub-page from the equation and without that it works without hassle.
So the root of the problem is def. in the WebAPI / Get Files section..
With that being cleared out, what would be the best prospect here?
/Karl
12-04-21 02:13 PM
@Michael ONeil
It´s now both in the end and the beginning.
A colleague of mine started the build and i am finishing the last parts.
And yes, the last "Detele" is now redundant since i will check the Success Flag as output from Delete Files.
I will try to remove the last one and put the first one after i made sure global data is "reset".
Thanks for the tip.
12-04-21 03:13 PM
12-04-21 03:24 PM
Hello Karl,
I see that colleagues have replied to you with suggestions, but just to chime in:
- I have a process that generates files and saves them in a temp folder. As a house keeping task I have set up a sub process that deletes files older than 2h. This way if something goes wrong, the most recent files can be manually retrieved from the folder
- if you need to delete the files straight away then - assuming you use the scheduler - you could set a trigger with a time delay of, say, 1-2 min, to run after your main process and delete all files in that particular folder
- or perhaps you could run a nightly house keeping tasks that checks if the designated folder contains files, and if true, deletes them all
Just my 2p!
BW
Marcin
12-04-21 07:08 PM
@ewilson, @Michael ONeil & @Marcin Dabrowski
Hi again and thank you for you efforts.
I have now solved the problem and the easiest way (i think...) to solve it was..
Use the ItemKey and include it in the PDF filename, When using Get Files, Use the last 4 in the ItemKey to fetch those specific files needed at the moment.
So instead of delete after each upload, stack the files until process is done.
Wait with the delete until last step or after process is finished or as a separate sub-process.
Not done with that yet, testing my solution above but i´m sure it will do the trick.
Thanks once again and have a great evening.
All the best,
Karl