newbobbys9
MIS
I work at a school and need to empty student home directories at the end of the school year. Is there something that will accomplish this? Any help would be appreciated. Thanks.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
On Error Resume Next
'Declare variables
Dim objFSO, oSubFolder, oFolder1, oSubFolder1, colSubfolders1, oFile
'Set up environment
Set objFSO = CreateObject("Scripting.FileSystemObject")
'start deleting files
Set oFolder1 = objFSO.GetFolder("home folder location")
For Each oFile In oFolder1.files
oFile.Delete True
Next
'Delete folders and subfolders
Set colSubfolders1 = oFolder1.Subfolders
For Each oSubfolder in colSubfolders1
objFSO.DeleteFolder oSubFolder.path,True
Next