VBS Script - Recursively Delete all Files in a Folder

I found this post and it work for me.

http://clintboessen.blogspot.com/2009/07/vbs-script-recursively-delete-all-files.html


VBS Script - Recursively Delete all Files in a Folder

This script deletes all files under a particular folder, in this example c:\test.

set objFSO = createobject("Scripting.FileSystemObject")
set objFolder = objFSO.GetFolder("C:\test")

for each folder in objFolder.SubFolders
objFSO.DeleteFolder folder.path, True
next

for each file in objFolder.Files
objFSO.DeleteFile file.path, True
next

Comments

Popular posts from this blog

Extracting and using a modified VMWare Player BIOS or UEFI firmware

Activate Synology Active Backup for Business for DSM 6

Windows 11 internet/account bypass