Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Find largest files in directory and delete them

$
0
0

Hi,

I'm looking for a Powershell script dat finds the three largest files in a directory tree and delete these files. I found a script that lists those files, but how to delete them?

Here is what I got so far;

gci E: -r| sort -descending -property length | select -first 3 name, @{Name="Gigabytes";Expression={[Math]::round($_.length / 1GB, 2)}}

Thanks!


Viewing all articles
Browse latest Browse all 15028

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>