This is one of the very first script I wrote years ago. I am just going to post it here for my future reference. This is an alternative solution to clean up the user folder by using the script posted
here .
Instead of traverse the subfolders recursively and delete the objects one by one, why not delete them all at once and create just the user folders.
-----------------------------Start------------------------------
On Error Resume next
Dim colFolders
colFolders = "username1," & _
"username2," & _
"username3," & _
"usernmae4," & _
"username5," & _
"username6," & _
"username7"
Dim path
Dim path_prefix
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim WshShell, objExec
Set WshShell = CreateObject("WScript.Shell")
path_prefix = "\\fileserver\Userhome\"
objFolder = Split(colFolders, ",")
For Each Folder in objFolder
path = path_prefix & Folder
' Create the user folder
objFSO.CreateFolder(path)
' Set appropriate permission
Set objExec = WshShell.Exec("cacls " & path &" /e /g " & Folder & ":f")
' Wait for the process to finish before continue
Do While objExec.Status = 0
WScript.Sleep 100
Loop
Next
------------------------------End---------------------------------