Topic "Get Size of Directory via command line"

Author Message
STetters

Guest


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
calculate.PNG (16.28 KB)

Description: Calculate folder size within gui

calculate.PNG

martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
It's easy with WinSCP .NET assembly and PowerShell
https://winscp.net/eng/docs/library_powershell

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

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License