How find the biggest file in folder?

Product:

Microsoft Powershell

Problem:
You are low on disk space, or the Cognos BI have created some large file (dump files or log files) and you want to know where they are.

Solution:
Enter below text in notepad++ and save as checksize.ps1 in your c:\temp folder

$folder = “C:\Program Files\ibm\cognos”
Get-ChildItem $folder -recurse -ErrorAction SilentlyContinue |Sort-Object length -descending| Select-Object -first 27 @{Name=”MegaBytes”;Expression={“{0:F2}” -f ($_.length/1MB)}} , Fullname | Export-Csv c:\temp\LargeFiles_Report.csv

Start Powershell from Start menu
Go to temp folder with command cd /temp
Enter ./checksize.ps1 to run the script


Open the Largefile_report.csv in notepad++

You need to change the first line to your folder for Cognos products e.g. $folder = “D:\Program Files\ibm\cognos\analytics”

Then you check the list to find the files that you do not need, and can remove them, to get more space.

More Information:
https://www.linkedin.com/pulse/powershell-script-finding-large-size-files-your-windows-milad-mousavi/?articleId=6610936483329257472

http://woshub.com/find-large-files-with-powershell/ 

https://blog.danskingdom.com/find-largest-or-smallest-files-in-a-directory-or-drive-with-powershell/