troubleshooting Question

Trying to figure out the syntax of a powershell command to delete specific folders.

Avatar of Jason Komendat
Jason Komendat asked on
PowershellWindows Batch
10 Comments1 Solution371 ViewsLast Modified:
We used to use folder redirection and have a lot of data on a server. I need to remove specific folders from each users profile folder. For example we have a folder called users in it is UserA, User B etc in each folder there is a Pictures, Music folder. Its these Music and Pictures folder I need to remove but for thousands of users.

I was looking at something like this But it doesn't jsut do the Users\userA\pictures folder it also removes any folder called pictures in any sub folder in the users folder.
Get-ChildItem -path E:\users -Include 'Pictures' -Recurse -force | Remove-Item -force -Recurse -whatif

I had found a command that would do this 6 months ago when we stopped redirecting another folder but I cannot find the command.

I need something that goes to userA folder deletes either the folder called Pictures or the content of it then moves on to the User B folder.

Can anyone help
ASKER CERTIFIED SOLUTION
Qlemo
"Batchelor", Developer and EE Topic Advisor

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2015

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros