Delete Folder with content

Delete Folder with content

Postby ali » Sat Nov 22, 2008 2:43 pm

Hi!

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

Thanks for your help.

Regards Aljoscha
ali
 
Posts: 23
Joined: Wed May 07, 2008 2:50 pm
Location: Austria

Postby RAMESHBABU » Sat Nov 22, 2008 3:01 pm

Hi Aljoscha,

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

Code: Select all  Expand view
WinExec("DELTREE "+cFolder,0)


Regards,

Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby ali » Sat Nov 22, 2008 3:18 pm

Hi!

In the forum I have found a Function. Look:
Code: Select all  Expand view
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
ali
 
Posts: 23
Joined: Wed May 07, 2008 2:50 pm
Location: Austria

Postby driessen » Sat Nov 22, 2008 4: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby RAMESHBABU » Sun Nov 23, 2008 12:48 pm

Hello Mr.Driessen,

Code: Select all  Expand view
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
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 62 guests