develooper Front page | perl.perl6.users | Postings from October 2022

Re: folder size

Thread Previous
From:
ToddAndMargo via perl6-users
Date:
October 23, 2022 06:24
Subject:
Re: folder size
Message ID:
6cadc603-f4a7-0113-cb4c-01edb085b891@zoho.com
On 10/22/22 22:46, Bruce Gray wrote:
> 
> 
>> On Oct 22, 2022, at 11:30 PM, ToddAndMargo via perl6-users <perl6-users@perl.org> wrote:
>>
>> Hi All,
>>
>> Does Raku have a folder size command (including sub
>> folders)
> 
>> or is that a system call?
> 
> There are system calls to get sizes of individual files (Raku IO objects provide the same function via the `.s()` method), but even in C language, you have to walk the directory tree and ask for the sizes of each file, then sum them yourself.
> 
> The File::Find module can handle the walking for you, allowing for this tight solution:
> 
> raku -e "use File::Find; say find(dir => <.>)ยป.s.sum;"
> 


Thank you!


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About