Edgar82

Delete script for D: partition except map Users

2 posts in this topic

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now