Hi Timm,
The easiest way: Just use a TRY..CATCH
But I suggest to first read all the files on that directory and below and try to delete them one by one. If any deletion fails show a message.
Use the following function to retrieve all the files.
Regards,
Code: Select all
STATIC FUNCTION RecurseDir( cMask, lRecursive, aFiles )
LOCAL aDir, aFile
LOCAL cPath, cFile
DEFAULT aFiles TO {}, lRecursive TO .F.
aDir := Directory( cMask )
cPath := FilePath( cMask )
cMask := FileFullname( cMask )
FOR EACH aFile IN aDir
cFile := aFile[ F_NAME ]
AAdd( aFiles, cPath + "\" + cFile )
NEXT
IF lRecursive
aDir := Directory( cPath + "\*.*", "D" )
FOR EACH aFile IN aDir
cFile := aFile[ F_NAME ]
IF "D" $ aFile[ F_ATTR ] .AND. cFile != "." .AND. cFile != ".."
RecurseDir( cPath + "\" + cFile + "\" + cMask, .T., @aFiles )
ENDIF
NEXT
ENDIF
RETURN aFiles