Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: UDF Delete Empty Directories
#DefineFunction DeleteDirectories(Root) ; DirList = DirItemize(StrCat(Root,"\*.*")) Total = 0 while @TRUE NextDir = ItemExtract(1,DirList,@TAB) if NextDir == "" then break DirList = ItemRemove(1,DirList,@TAB) NextDir = StrCat(Root,"\",NextDir) Count = DeleteDirectories(NextDir) if Count == 0 DirRemove(NextDir) else Total = Total + Count + 1 endif endwhile Count = ItemCount(FileItemize(StrCat(Root,"\*.*")),@TAB) Total = Total + Count return Total #EndFunction ;----------------------------------------------------------- ; Test the UDF ;----------------------------------------------------------- TestDir = "C:\Windows\Desktop\Test" x = DeleteDirectories(TestDir) if x == 0 then DirRemove(TestDir)
Article ID: W15319
File Created: 2002:09:05:13:51:20
Last Updated: 2002:09:05:13:51:20