Thank you very much Glenn! Here's what I'm using: @echo off SetLocal set @BaseDir=I:\users\adult_ed\students\Evening\ :CheckHelp IF /I "%1" == "" GOTO :HelpMessage :Remove Quotes SET @User=%1 SET @UserNQ=%@User:"=% :Dothedelete FOR /f "tokens=*" %%i in ('dir "%@BaseDir%%@UserNQ%\" /b /s /a-d') do del /f "%%i" FOR /f "tokens=*" %%i in ('dir "%@BaseDir%%@UserNQ%\" /b /ad') do rd /s /Q "%@BaseDir%%@UserNQ%\%%i" goto :EOF :HelpMessage ECHO. ECHO Syntax Help for DELUSER.BAT ECHO. ECHO === DelUser {username} ECHO. ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ECHO NOTE: User names which contain spaces ECHO should be surrounded by quotes. ECHO. ECHO This utility shall only be used ECHO under authority of Drew Shriner. ECHO. ECHO Please call x1378 for any ECHO questions or for assistance. ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ECHO. Drew -----Original Message----- From: windows2000-bounce@xxxxxxxxxxxxx [mailto:windows2000-bounce@xxxxxxxxxxxxx] On Behalf Of Sullivan, Glenn Sent: Tuesday, March 30, 2004 12:57 AM To: windows2000@xxxxxxxxxxxxx Subject: [windows2000] Re: Removing contents of a directory I just read your followup post... add this after the delete line: FOR /f "tokens=*" %%i in ('dir "%@BaseDir%%@UserNQ%\" /b /ad') do rd /s "%%i" to delete the directories under the username directory, but not the username directory itself. Glenn Sullivan, MCSE+I MCDBA David Clark Company Inc. -----Original Message----- From: windows2000-bounce@xxxxxxxxxxxxx [mailto:windows2000-bounce@xxxxxxxxxxxxx] Posted At: Tuesday, March 30, 2004 12:53 AM Posted To: Windows 2000 Conversation: [windows2000] Removing contents of a directory Subject: [windows2000] Re: Removing contents of a directory And to take it to the next level, make it accept a username: @echo off SetLocal set @BaseDir=c:\ :CheckHelp IF /I "%1" == "" GOTO :HelpMessage :Remove Quotes SET @User=%1 SET @UserNQ=%@User:"=% :Dothedelete FOR /f "tokens=*" %%i in ('dir "%@BaseDir%%@UserNQ%\" /b /s /a-d') do del /f "%%i" goto :EOF :HelpMessage ECHO. ECHO Syntax Help for DELUSER.BAT ECHO. ECHO === DelUser {username} ECHO. ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ECHO NOTE: User names which contain spaces ECHO should be surrounded by quotes. ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ECHO. Hope this helps, Glenn Sullivan, MCSE+I MCDBA David Clark Company Inc. -----Original Message----- From: windows2000-bounce@xxxxxxxxxxxxx [mailto:windows2000-bounce@xxxxxxxxxxxxx]On Behalf Of Sullivan, Glenn Posted At: Tuesday, March 30, 2004 12:01 AM Posted To: Windows 2000 Conversation: [windows2000] Removing contents of a directory Subject: [windows2000] Re: Removing contents of a directory Combine the FOR command and the DIR command. DIR <directory> /b /s /a-d Lists a given directory and all subdirectories, with no headers or other crap... just the full path and filename. Throw that into a for /f statement, and you get: FOR /f %i in ('dir <directory> /b /s /a-d') do del /f "%i" Change the "del /f" to "echo" or "del /p" if you just want to test. And if you want it in a .cmd file, you would need to double up the percent signs, like so: FOR /f %%i in ('dir <directory> /b /s /a-d') do del /f "%%i" Hope this helps, Glenn Sullivan, MCSE+I MCDBA David Clark Company Inc. -----Original Message----- From: windows2000-bounce@xxxxxxxxxxxxx [mailto:windows2000-bounce@xxxxxxxxxxxxx]On Behalf Of Drew S Posted At: Monday, March 29, 2004 11:31 PM Posted To: Windows 2000 Conversation: [windows2000] Removing contents of a directory Subject: [windows2000] Removing contents of a directory Hey all... I *should* know of a way to do this, but don't. Here's the scenario: I need a way to purge the contents of a certain directory (folder), so that all files, subdirectories, etc., EVERYTHING is removed from this folder. I would normally just RMDIR the directory and then recreate it. However, there are network permissions declared explicitly on this directory, and I can't afford to have to apply those permissions again, manually. A little more detail: Say our user accounts are at: \\server0\data\users\department\%username%\ Also mapped as i:\users\department\%username% for admins I need the admins to be able to purge all of the contents of their user directory (the path listed above), but they cannot purge the directory itself, as it would be very laborious to manually define each folder's user permission. Is there a way to tell the system to recursively remove everything so that it removes everything under the user folder? I don't want *ANYTHING* to exist under the %username% folder. We are not, however, purging the data for all usernames - just specific ones. They do happen to be sequential, though. BTW, this network uses Novell Netware instead of Windows 2000 Active Directory, just in case you were thinking of any windows 2000 solutions. All clients are Windows XP. I feel stupid for asking this... seems like a very simple problem. I'd like to integrate this into a batch script so that when the time comes to do this all over again (this will need to be done like once every 2 months), the admin can just run the batch file and all of the user files will be purged. I will, of course, build a safety feature in so that the admin can't accidentally run the script and make a lot of people angry. Drew ******************************************************** This Weeks Sponsor StressedPuppy.com Games Feeling stressed out? Check out our games to relieve your stress. http://www.StressedPuppy.com ******************************************************** To Unsubscribe, set digest or vacation mode or view archives use the below link. http://thethin.net/win2000list.cfm ******************************************************** This Weeks Sponsor StressedPuppy.com Games Feeling stressed out? Check out our games to relieve your stress. http://www.StressedPuppy.com ******************************************************** To Unsubscribe, set digest or vacation mode or view archives use the below link. http://thethin.net/win2000list.cfm ******************************************************** This Weeks Sponsor StressedPuppy.com Games Feeling stressed out? Check out our games to relieve your stress. http://www.StressedPuppy.com ******************************************************** To Unsubscribe, set digest or vacation mode or view archives use the below link. http://thethin.net/win2000list.cfm ******************************************************** This Weeks Sponsor StressedPuppy.com Games Feeling stressed out? Check out our games to relieve your stress. http://www.StressedPuppy.com ******************************************************** To Unsubscribe, set digest or vacation mode or view archives use the below link. http://thethin.net/win2000list.cfm __________ NOD32 1.693 (20040325) Information __________ This message was checked by NOD32 Antivirus System. http://www.nod32.com ******************************************************** This Weeks Sponsor StressedPuppy.com Games Feeling stressed out? Check out our games to relieve your stress. http://www.StressedPuppy.com ******************************************************** To Unsubscribe, set digest or vacation mode or view archives use the below link. http://thethin.net/win2000list.cfm