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

Home Forums Scripting PowerShell Trying to figure out the syntax of a powershell command to delete specific folders.

This topic contains 0 replies, has 1 voice, and was last updated by  jason0923 1 year ago.

Viewing 1 post (of 1 total)
  • Author
    Posts

  • jason0923
    Participant
    #167331

    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 UsersuserApictures 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

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.