On Tue, 30 Mar 2004 00:01:10 -0500, Sullivan, Glenn wrote: >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" Doesn't "deltree" handle UNC-pathways? >-----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. BW, Sorin # Sorin Srbu, Systems Engineer Web: http://www.farmfak.uu.se/organisk/ # Dept of Medicinal Chemistry, Phone: +46 (0)18-4714482 >> 5 signals >> GSM # Div of Org Pharm Chem, Mobile Phone: +46 (0)701-718023 # BMC, Box 574, Uppsala University Fax: +46 (0)18-4714474 # SE-751 23 Uppsala, Sweden Visit: BMC, Husargatan 3, D5:512b # # Public PGP key available on request. # # () ascii ribbon campaign - against html e-mail # /\ # # # Harmless tagline follows: # # BOFH excuse follows: CPU-angle has to be adjusted because of vibrations coming from the nearby road ******************************************************** 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