Jump to content
Edgar82

Delete script for D: partition except map Users

Recommended Posts

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...