How find the biggest file in folder?


Microsoft Powershell

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.

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: