Delete the Files from download folder, from several Users at the same time

Hello

I try to delete the files of the download folders of several users at once.
This is the code:

 ForFiles /p "C:\Users\jp\desktop\test\%\" /s /d -30 /c "cmd /c del /q @file"

In the test folder there are multiply other folders and in this folders are 2 files one older then 30 days one younger.

I think my problem is the % character.

Does anyone have an idea?

That’s not PowerShell :slight_smile:

This will remove everything in their Downloads folder:

Get-ChildItem E:\Temp\Files\Users -Recurse -Directory -Filter Downloads | 
    foreach {Get-ChildItem $_.FullName | 
        Remove-Item}

This will remove everything older than 30 days:

Get-ChildItem E:\Temp\Files\Users -Recurse -Directory -Filter Downloads | 
    Foreach-Object {Get-ChildItem $_.FullName | 
        Where-Object {$_.CreationTime -lt (Get-Date).AddDays(-30)} |
            Remove-Item}

Note: both commands can be on one line, I split them up at the pipe for readabilty on the forum.