FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Delete Folder with content
Posts: 23
Joined: Wed May 07, 2008 02:50 PM
Delete Folder with content
Posted: Sat Nov 22, 2008 02:43 PM

Hi!

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

Thanks for your help.

Regards Aljoscha

Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Delete Folder with content
Posted: Sat Nov 22, 2008 03:01 PM
Hi Aljoscha,

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

WinExec("DELTREE "+cFolder,0)


Regards,

Ramesh Babu P
Posts: 23
Joined: Wed May 07, 2008 02:50 PM
Delete Folder with content
Posted: Sat Nov 22, 2008 03:18 PM
Hi!

In the forum I have found a Function. Look:
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
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Delete Folder with content
Posted: Sat Nov 22, 2008 04:17 PM

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.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Delete Folder with content
Posted: Sun Nov 23, 2008 12:48 PM
Hello Mr.Driessen,

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

Continue the discussion