How do I create wildcards for folder names for mass deleting a folder located under each users profile?

There is a folder that I want to delete that is located under each users profile folder on our server it looks something like this \\server\"insert users name here"\Application Data\Microsoft\Internet Explorer. I would like to know how I could go about creating a batch file that would allow me to put in a wildcard where the users name is so that no matter what the users folder name is it will just go in and find the folder \Internet Explorer and delete it for all 250 so users.
kjcceeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
forrestoffConnect With a Mentor Commented:
this may help, and if you choose, you could type it into the command prompt but you'd have to change all the %%i's to %i.

The command enumerates the directory structure of users in \\server\ and will remove, recursively, the directory "Internet Explorer" found within the path.
for /f "usebackq" %%i in (`dir/b \\server\`) do rmdir /s /q "\\server\%%i\Application Data\Microsoft\Internet Explorer"

Open in new window

0
 
kjcceeAuthor Commented:
That worked perfectly thank you
0
 
kjcceeAuthor Commented:
That worked perfectly thank you
0
 
forrestoffCommented:
You're welcome! :)
0
All Courses

From novice to tech pro — start learning today.