Delete Folder with content

Post Reply
ali
Posts: 23
Joined: Wed May 07, 2008 2:50 pm
Location: Austria

Delete Folder with content

Post by ali »

Hi!

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

Thanks for your help.

Regards Aljoscha
User avatar
RAMESHBABU
Posts: 591
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Post 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
ali
Posts: 23
Joined: Wed May 07, 2008 2:50 pm
Location: Austria

Post 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
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Post 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.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
RAMESHBABU
Posts: 591
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Post 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
Post Reply