Get Size of Directory via command line

Advertisement

STetters
Guest

Get Size of Directory via command line

Using the properties option within the GUI, you can click on the calculate button and get the size of the folder including sub folders.


Is there any way of getting this same information using the CLI ?

Many thanks

Steve

Description: Calculate folder size within gui

calculate.PNG

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Get Size of Directory via command line

It's easy with WinSCP .NET assembly and PowerShell
https://winscp.net/eng/docs/library_powershell

$files =
    $session.EnumerateRemoteFiles(
        "/remote/path", $Null, [WinSCP.EnumerationOptions]::AllDirectories)
$size = ($files | Measure-Object -Property Length -Sum).Sum    

Reply with quote

Advertisement

You can post new topics in this forum