|
| How to force a file to close? |
| Iniciado por guest, 16,feb. 2018 13:43 - 3 respuestas |
| |
| | | |
|
| |
| Publicado el 16,febrero 2018 - 13:43 |
Not quite the obvious fclose()!
I am running a process on a web server and want to delete files in a folder but only fic/mmo/ndx. I use flist to get the files in the folder then loop round the result and deleting any files with the appropriate filter. I use this code all the time to do various things.
However in this case when deleting the file I get an error saying "the file is being used by another process".
I have tried disconnecting from the database, using funlock and fclose then fdelete but the file is still being used.
Is there any way to force a file to close so it can be deleted?
Thx |
| |
| |
| | | |
|
| | |
| |
| Publicado el 16,febrero 2018 - 13:50 |
Hi
the file needs to be closed by the process that did open it with an hclose...
And there are several problems with that: - if HFCS, then the HS SERVICE is the one opening the files, so you may TRY with the instruction to force a HFCS full stop - if HF Classic, then each and every webdev session accessing the files has open them, so each one needs to either terminate or close the file...
In both cases, this is easier said than done... If you wan to FORCE CLOSE the files from the 'outside', you'll need to use some API and be administrator, and if you do that, you will probably cause a crash in the process that was using the file
So I would personally start by reviewing the logic of what I'm trying to do: deleting files currently in use may not be the best way to achieve whatever it is you want to achieve
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 16,febrero 2018 - 14:15 |
I agree absolutely. The problem is that I don't know what process has opened the files. It is not the service I am running I don't think and certainly not my server procedure.
Is there a way to find out what opened the file?
Thx |
| |
| |
| | | |
|
| | |
| |
| Publicado el 16,febrero 2018 - 14:17 |
Sorry just realized! Its the HFControlCentre (WAS) on the server.
Hmm, there is a way round this but very messy. No worries. |
| |
| |
| | | |
|
| | | | |
| | |
|