Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#include <windows.h>
#include <stdio.h>
BOOL DelTree ( char *Dir )
{
DWORD Attr = GetFileAttributes ( Dir );
if ( Attr == 0xffffffff )
{ return FALSE; }
if ( !(Attr & FILE_ATTRIBUTE_DIRECTORY )) // Not a directory
{ SetLastError ( 3 );
return FALSE; }
WIN32_FIND_DATA wfd;
char DirContents[MAX_PATH];
strcpy ( DirContents, Dir );
strcat ( DirContents, "\\*" );
HANDLE FH = FindFirstFile ( DirContents, &wfd );
if ( FH != INVALID_HANDLE_VALUE )
{
do {
strcpy ( DirContents, Dir );
strcat ( DirContents, "\\" );
strcat ( DirContents, wfd.cFileName );
if ( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
{
if ( strcmp ( wfd.cFileName, "." ) != 0 &&
strcmp ( wfd.cFileName, ".." ) != 0 )
{ if ( !DelTree ( DirContents ))
{ FindClose ( FH );
return FALSE; } } } else
{ if ( !DeleteFile ( DirContents ))
{ FindClose ( FH );
return FALSE; } }
} while ( FindNextFile ( FH, &wfd ));
FindClose ( FH ); }
return RemoveDirectory ( Dir ); }
void main ( int argc, char *argv[] )
{
if ( argc < 2 )
{ printf ( "Usage: %s Dirname [Dirname ...]\n", argv[0] );
exit ( 1 ); }
for ( int i1 = 1; i1 < argc; i1++ )
{ printf ( "Removing directory %s ...", argv[i1] );
if ( DelTree ( argv[i1] ))
{ printf ( "OK\n" ); } else
{ printf ( "Error %d\n", GetLastError ( )); } } }