Edgar82 0 Report post Posted December 3, 2015 Hi everybody, Im searching for a script that can delete files and folders except the folder d:\Users\ and all the files and folders under this folder. It doesn't matter if it is VB or Bat file. How can we manage this? Share this post Link to post Share on other sites
smus 0 Report post Posted March 10, 2016 You can check the folders through the cycle. It's gonna look like this: @echo off set allfolders = 'dir /b /s /a:d D:' set usersfolder = 'D:\users\' for /f "delims=" %%I in %%allfolders do ( [here's the exception] ) [here is the deletion] Share this post Link to post Share on other sites