PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Re: Could not Delete HFSQL (Classic) folder
Re: Could not Delete HFSQL (Classic) folder
Iniciado por Sivaprakash, 22,ene. 2018 04:16 - 2 respuestas
Publicado el 22,enero 2018 - 04:16
Hello,

Would like to delete a folder where hfsql - classic files are stored. I do read those files first then give the user the option to delete the folder altogether. I get the following error.

Unable to delete directory. Check whether you have sufficient rights and whether all the files are closed.

My code to delete

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
WHEN EXCEPTION IN
HClose("*")
HCloseConnection(a360_DataBaseConnection)
DO
Info("HFSQL error while closing connections: " + HError() + HErrorInfo())
a360TransactionCancel(a360_DatabaseConnectionType, a360_ClassicDatabaseTRS, p_sErrorMessage)
RESULT False
END

e_resdelete = fRemoveDir(CompleteDir(a360_classicDir) + p_sCompanyFolder, frRecursive)
IF e_resdelete = False THEN
Info("Directory could not be removed. Check whether you have sufficient rights" + ErrorInfo())
RESULT False
END

// OK Return True
RESULT True

////////////////////////////////////////////////////////////////////////////////////

I get error while executing fRemoveDir command. Seems some files are still open that the folder could not be deleted.

When the folder is deleted from Windows explorer or command prompt, after closing the package, it deletes without any issues.

Would like to know what else I'm missing?

Happiness Always
BKR Sivaprakash
Publicado el 23,enero 2018 - 10:34
Hi Sivaprakash,

You could try and see what happens if you don't use a connection to open the classic files.
Perhaps the connection -even if closed- uses some kind of locking mechanism.

Kind regards,
Piet
Publicado el 27,enero 2018 - 12:10
Thanks Piet.

Looks like a wrong place of closing files and closing connection.

Before deleting the directory, I used to read files and display those details in a table. I just tried closing the files after display there itself.

Now I could delete the folder.

Happiness Always
BKR Sivaprakash