Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Help with simple script to remove subfolders from directory structure

$
0
0

You could use the wildcard and pipe the results to Remove-Item.

dir \\server1\c$\users\*\downloads\* | where LastWriteTime -lt $cutoff | rm -Confirm

In this example, I removed files. But you could also remove whole directories. You will want to use the -Recurse and -Force switches.


Viewing all articles
Browse latest Browse all 13067

Trending Articles