Hi All
I am trying to delete all files in sub folders with the code below, but not delete the sub folders which this code below does.
Regards
Steve
Code:Dim OFS, Sfolder, Subfolder, File, Folder Set OFS = CreateObject("Scripting.FileSystemObject") Sfolder = "d:\Images\" & NextMonth For Each Subfolder In OFS.GetFolder(Sfolder).SubFolders For Each File In OFS.GetFolder(Subfolder.Path).Files OFS.DeleteFile File.Path, True Next For Each Folder In OFS.GetFolder(Subfolder.Path).SubFolders OFS.DeleteFolder Folder.Path Next Next Set OFS = Nothing




Reply With Quote