kapiaba Posted December 1, 2014 Report Share Posted December 1, 2014 /* Hola ! Seguro que hay algo ya hecho al respecto pero por si a alguien le sirve... Esta función sirve para borrar un directorio que contenga archivos u otros directorios, borra el contenido interior de cada directorio. Esta hecha con FWH 2.4 Bueno, espero que os sirva Un saludo Jesús Díez González */ //--------------------------------------- // Autor: Jesús Díez González // 27/10/2003 #include "FiveWin.ch" #include "Directry.ch" FUNCTION Main() LOCAL cDir := "C:\LIXO3" EliminaDir(cDir) RETURN NIL FUNCTION EliminaDir(cDir) LOCAL aDir := Directory(cDir+"\*.*","DR") RecorreDir(aDir,cDir) RETURN !lIsDir(cDir) STATIC FUNCTION RecorreDir(aDir, cDir,cAtt) Local nRemove aEval( aDir, {|aFile,c,a| c := aFile[F_NAME] ,; a := aFile[F_ATTR] ,; IF( "D" $ a ,; // Es un Directorio IF( "." $ c,; nil ,; // . y .. No se eliminan :-) RecorreDir(; Directory(cDir+"\"+c+"\*.*","DR"),cDir+"\"+c, a )) ,; FErase(cDir+"\"+c) ) } ) nRemove:= DirRemove(cDir) //? nRemove IF nRemove = 0 ? "Diretorio Removido!" ELSE // 2 ? "Diretorio nao Existe!" ENDIF RETURN nRemove Quote Link to comment Share on other sites More sharing options...
sambomb Posted December 1, 2014 Report Share Posted December 1, 2014 FUNCTION EliminaDir(cDir) If IsDir(cDir) WinExec("RD " + cDir + " /S",0) Else ? "Diretório " + cDir + " inválido." End Return kapiaba 1 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted December 1, 2014 Author Report Share Posted December 1, 2014 FUNCTION EliminaDir(cDir) If IsDir(cDir) WinExec("RD " + cDir + " /S",0) Else ? "Diretório " + cDir + " inválido." End Return Boa!! Mais uma idéia. Thanks!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.