Delete all folders in a folder except two
Posted: 06 Oct 2010 10:19
I am writing a script that will remove all of the user accounts on a computer. Currently the code is:
rmdir /s /q "\\%computername%\c$\Documents and Settings\"
This removes all folders (user windows profiles) under the documents and settings folder. The problem is this also removes the "All Users" folder and the "Default User" folders as well. I need a way to remove all other folders than these two folders. The user ID's for each computer will vary so it wont be as simple as just deleting specific folders.
Any thoughts?
rmdir /s /q "\\%computername%\c$\Documents and Settings\"
This removes all folders (user windows profiles) under the documents and settings folder. The problem is this also removes the "All Users" folder and the "Default User" folders as well. I need a way to remove all other folders than these two folders. The user ID's for each computer will vary so it wont be as simple as just deleting specific folders.
Any thoughts?