I placed a debug code to tell me if the delte process fails, and for some reason... I can not delete any of the files

Here is my code (only the applicable part):
Code: Select all
#HistoryDir.s = "history\" ;history directory
#HistoryExt.s = ".hx" ;history extension
ExamineDirectory(#PB_Any, #HistoryDir, "*"+#HistoryExt)
Repeat
FileType = NextDirectoryEntry()
If FileType = 1
FileName$ = DirectoryEntryName()
Debug(FileName$)
If DeleteFile(FileName$)=0:Debug "cant delete":EndIf
EndIf
Until FileType = 0
Thanks in advance