Announcement

Collapse
No announcement yet.

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

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

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

    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
Working...
X