Delete All Contents of "FolderName" -recursive

I need to identify all folders that match \Foldername1\Foldername2 under \Users…

\users has multiple %USERNAME% directories under it.

Then delete all files under Foldername2

Ok you could use Get-ChildItem to find the directory and Remove-Item to delete it’s contents.

THanks, but if I understand correctly Get-ChildItem only spans the current directory. I have to find “Folder3” under


Where each username is unique, and then delete the contents of all files in Folder3 for each user. I am also new to PS, so looking for examples …


Something like this:

Get-ChildItem -Path C:\Users\ -Include folder1 -Recurse -Depth 2 -Directory | 
Get-ChildItem -Directory -Include folder2 | 
Get-ChildItem -Directory -Include folder3

Test the output and adjust accordingly; finally pipe the output to Remove-Item.

There are a few examples on the MS docs page.

You can use wildcards in the path.

Get-ChildItem -path c:\users\*\folder1\folder2\folder3

Similarly you could use Resolve-Path.

Resolve-Path -Path c:\users\*\folder1\folder2\folder3