Page 1 of 1

Delete Folder with content

Posted: Sat Nov 22, 2008 2:43 pm
by ali
Hi!

How can I delete a folder with content. Is this in FW possible?

Thanks for your help.

Regards Aljoscha

Posted: Sat Nov 22, 2008 3:01 pm
by RAMESHBABU
Hi Aljoscha,

The following code will completely delete cFolder and its all contents including subfolders from its parent.

Code: Select all

WinExec("DELTREE "+cFolder,0)
Regards,

Ramesh Babu P

Posted: Sat Nov 22, 2008 3:18 pm
by ali
Hi!

In the forum I have found a Function. Look:

Code: Select all

FUNCTION DELETEDIR( cDir ) 

    LOCAL aDir, cName 

    LOCAL i
    
    aDir = DIRECTORY( cDir + "\*.*", "HRD" ) 

    FOR i = 1 TO LEN( aDir ) 
        cName = aDir[ i, F_NAME ] 

        IF cName == "."; LOOP; ENDIF 
        IF cName == ".."; LOOP; ENDIF 

        cName = cDir + "\" + cName 

        IF "D" $ aDir[ i, F_ATTR ] 
            IF !DELETEDIR( cName ) 
                RETURN .F. 
            ENDIF 
        ELSE 
            IF FERASE( cName ) = -1 
                ? "Impossibile cancellare il file " + cName + "." 
                RETURN .F. 
            ENDIF 
        ENDIF 
    NEXT 

    //IF !LRMDIR( cDir ) 
    //    ? "Impossibile cancellare la cartella " + cDir + "." 
    //    RETURN .F. 
    //ENDIF 

    RETURN .T.
RAMESHBABU thank you for your help

regards Aljoscha

Posted: Sat Nov 22, 2008 4:17 pm
by driessen
Ramush,

DELTREE.EXE is a command of Windows 98 or 95. It doesn't exist in Windows NT, 2000, XP or Vista.

Altough if you can have a copy of the original DELTREE.EXE of Windows 98 or 95, it does work in NT, 2000, XP or Vista.

If needed, I can provide DELTREE.EXE.

Posted: Sun Nov 23, 2008 12:48 pm
by RAMESHBABU
Hello Mr.Driessen,

Code: Select all

DELTREE.EXE is a command of Windows 98 or 95. It doesn't exist in Windows NT, 2000, XP or Vista. 

Altough if you can have a copy of the original DELTREE.EXE of Windows 98 or 95, it does work in NT, 2000, XP or Vista. 
Yes as you said, DELTREE.EXE is not provided in Windows NT, 2000, XP or Vista.

I am running both Win98 SE and XP in my system. Now after your above comment, I have copied DELTREE.EXE into my daughter's LAPTOP having VISTA (32 Bit) Home Premium and tested. It is working perfect.

My experience with DELTREE.EXE is that it is working OK in WIN95, WIN98, XP and even in VISTA and also Windows 2003 Server and 2000 also.

- Ramesh Babu P