Implemented /S and /Q in remove directory.
Added a check for files in the folder. This fixes bug 742.
Updated res file, translators please update sometime soon.
Modified: trunk/reactos/subsys/system/cmd/En.rc
Modified: trunk/reactos/subsys/system/cmd/internal.c
Modified: trunk/reactos/subsys/system/cmd/resource.h

Modified: trunk/reactos/subsys/system/cmd/En.rc
--- trunk/reactos/subsys/system/cmd/En.rc	2005-10-02 20:03:20 UTC (rev 18231)
+++ trunk/reactos/subsys/system/cmd/En.rc	2005-10-02 20:17:59 UTC (rev 18232)
@@ -364,7 +364,10 @@
 STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]"
 
 STRING_RMDIR_HELP,   "Removes a directory.\n\n\
-RMDIR [drive:]path\nRD [drive:]path"
+RMDIR [drive:]path\nRD [drive:]path\n\
+/S			Deletes all files and folders within target\n\
+/Q			Doesnt prompt for user\n"
+STRING_RMDIR_HELP2,	"Directory is not empty!\n"
 
 STRING_REN_HELP1, "Renames a file/directory or files/directories.\n\n\
 RENAME [/E /N /P /Q /S /T] old_name ... new_name\n\

Modified: trunk/reactos/subsys/system/cmd/internal.c
--- trunk/reactos/subsys/system/cmd/internal.c	2005-10-02 20:03:20 UTC (rev 18231)
+++ trunk/reactos/subsys/system/cmd/internal.c	2005-10-02 20:17:59 UTC (rev 18232)
@@ -499,68 +499,163 @@
  * RD / RMDIR
  *
  */
+BOOL DeleteFolder(LPTSTR FileName)
+{
+	TCHAR Base[MAX_PATH];
+	TCHAR TempFileName[MAX_PATH];
+	HANDLE hFile;
+    WIN32_FIND_DATA f;
+	_tcscpy(Base,FileName);
+	_tcscat(Base,_T("\\*"));
+	hFile = FindFirstFile(Base, &f);
+	Base[_tcslen(Base) - 1] = _T('\0');
+    if (hFile != INVALID_HANDLE_VALUE)
+    {
+        do
+        {
+       		if (!_tcscmp(f.cFileName, _T(".")) ||
+                !_tcscmp(f.cFileName, _T("..")))
+		        continue;
+			_tcscpy(TempFileName,Base);
+			_tcscat(TempFileName,f.cFileName);
+
+			if(f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+				DeleteFolder(TempFileName);
+			else
+			{
+				SetFileAttributes(TempFileName,FILE_ATTRIBUTE_NORMAL);
+				if(!DeleteFile(TempFileName))
+					return 0;
+			}
+
+        }while (FindNextFile (hFile, &f));
+	    FindClose (hFile);
+    }
+	return RemoveDirectory(FileName);
+}
 INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
 {
 	LPTSTR dir;		/* pointer to the directory to change to */
-	LPTSTR place;	/* used to search for the \ when no space is used */
-
-	LPTSTR *p = NULL;
-	INT argc;
-
+	char ch;
+	INT args;
+	LPTSTR *arg = NULL;
+	INT i;
+	BOOL RD_SUB = FALSE;
+	BOOL RD_QUIET = FALSE;
+	HANDLE hFile;
+	WIN32_FIND_DATA f;
+	INT res;
+	TCHAR szMsg[RC_STRING_MAX_SIZE];
+	TCHAR szFullPath[MAX_PATH];
+	
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{
 		ConOutResPaging(TRUE,STRING_RMDIR_HELP);
 		return 0;
 	}
 
-	/* check if there is no space between the command and the path */
-	if (param[0] == _T('\0'))
+	nErrorLevel = 0;
+
+	arg = split (param, &args, FALSE);
+
+	if (args == 0)
 	{
-		/* search for the \ or . so that both short & long names will work */
-		for (place = cmd; *place; place++)
-			if (*place == _T('.') || *place == _T('\\'))
-				break;
+		/* only command given */
+		error_req_param_missing ();
+		freep (arg);
+		return 1;
+	}
 
-		if (*place)
-			dir = place;
-		else
-			/* signal that there are no parameters */
-			dir = NULL;
-	}
-	else
+	/* check for options anywhere in command line */
+	for (i = 0; i < args; i++)
 	{
-		p = split (param, &argc, FALSE);
-		if (argc > 1)
+		if (*arg[i] == _T('/'))
 		{
-			/*JPP 20-Jul-1998 use standard error message */
-			error_too_many_parameters (param);
-			freep (p);
-			return 1;
+			/*found a command, but check to make sure it has something after it*/
+			if (_tcslen (arg[i]) == 2)
+			{
+				ch = _totupper (arg[i][1]);
+				if (ch == _T('S'))
+				{
+					RD_SUB = TRUE;
+				}
+				else if (ch == _T('Q'))
+				{
+					RD_QUIET = TRUE;
+				}
+			}
 		}
 		else
-			dir = p[0];
+		{
+			/* get the folder name */
+			_tcscpy(dir,arg[i]);
+		}
 	}
-
+	
 	if (!dir)
 	{
+		/* No folder to remove */
 		ConErrResPuts(STRING_ERROR_REQ_PARAM_MISSING);
+		freep(arg);
 		return 1;
 	}
 
+	GetFullPathName(dir,MAX_PATH,szFullPath,NULL);
 	/* remove trailing \ if any, but ONLY if dir is not the root dir */
-	if (_tcslen (dir) >= 2 && dir[_tcslen (dir) - 1] == _T('\\'))
-		dir[_tcslen(dir) - 1] = _T('\0');
+	if (_tcslen (szFullPath) >= 2 && szFullPath[_tcslen (szFullPath) - 1] == _T('\\'))
+		szFullPath[_tcslen(szFullPath) - 1] = _T('\0');
 
-	if (!RemoveDirectory (dir))
+	if(RD_SUB)
 	{
+		/* ask if they want to delete evrything in the folder */
+		if (!RD_QUIET)
+		{
+			LoadString( CMD_ModuleHandle, STRING_DEL_HELP2, szMsg, RC_STRING_MAX_SIZE);
+			res = FilePromptYNA (szMsg);
+			if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
+			{
+				freep(arg);
+				nErrorLevel = 1;
+				return 1;
+			}
+		}
+
+	}
+	else
+	{
+		/* check for files in the folder */
+		_tcscat(szFullPath,_T("\\*"));
+
+		hFile = FindFirstFile(szFullPath, &f);
+		if (hFile != INVALID_HANDLE_VALUE)
+		{
+			do
+			{
+				if (!_tcscmp(f.cFileName,_T(".")) ||
+					!_tcscmp(f.cFileName,_T("..")))
+					continue;
+				ConOutResPuts(STRING_RMDIR_HELP2);
+				freep(arg);
+				FindClose (hFile);
+				nErrorLevel = 1;
+				return 1;
+			}while (FindNextFile (hFile, &f));
+			FindClose (hFile);
+		}
+		/* reovme the \\* */
+		szFullPath[_tcslen(szFullPath) - 2] = _T('\0');
+	}
+
+	if (!DeleteFolder(szFullPath))
+	{
+		/* Couldnt delete the folder, clean up and print out the error */
 		ErrorMessage (GetLastError(), _T("RD"));
-		freep (p);
-
+		freep (arg);
+		nErrorLevel = 1;
 		return 1;
 	}
 
-	freep (p);
-
+	freep (arg);
 	return 0;
 }
 #endif

Modified: trunk/reactos/subsys/system/cmd/resource.h
--- trunk/reactos/subsys/system/cmd/resource.h	2005-10-02 20:03:20 UTC (rev 18231)
+++ trunk/reactos/subsys/system/cmd/resource.h	2005-10-02 20:17:59 UTC (rev 18232)
@@ -219,7 +219,9 @@
 #define STRING_EXPECTED_CLOSE_PAREN        721
 #define STRING_EXPECTED_NUMBER_OR_VARIABLE 722
 #define STRING_SYNTAX_COMMAND_INCORRECT    723
+#define STRING_RMDIR_HELP2				   724
 
+
 /* These strings are language independent (cmd.rc) */
 #define STRING_FREEDOS_DEV                 800
 #define STRING_REACTOS_DEV                 801