Hi again, I am wondering if there is any way to extract the Folder size. For example, I want to get information of size for all folders in my C: drive. It seems that the function file.info() only work for File, not on Folder. Appreciate any pointer. Thanks and regards,
Hi Christopher,
sum(file.info(list.files(".", all.files = TRUE, recursive =
TRUE))$size)
should do the trick.
Cheers,
Luca
On Sun, Mar 1, 2015 at 12:33 PM, Christofer Bogaso
<bogaso.christofer at gmail.com> wrote:> Hi again,
>
> I am wondering if there is any way to extract the Folder size. For
> example, I want to get information of size for all folders in my C:
> drive.
>
> It seems that the function file.info() only work for File, not on Folder.
>
> Appreciate any pointer.
>
> Thanks and regards,
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
of course you can substitute "." with a path to your folder.. and you might want to set fullnames = TRUE and maybe include.dirs = TRUE in list.files On Sun, Mar 1, 2015 at 12:59 PM, Luca Cerone <luca.cerone at gmail.com> wrote:> Hi Christopher, > > sum(file.info(list.files(".", all.files = TRUE, recursive = TRUE))$size) > > should do the trick. > > Cheers, > Luca > > On Sun, Mar 1, 2015 at 12:33 PM, Christofer Bogaso > <bogaso.christofer at gmail.com> wrote: >> Hi again, >> >> I am wondering if there is any way to extract the Folder size. For >> example, I want to get information of size for all folders in my C: >> drive. >> >> It seems that the function file.info() only work for File, not on Folder. >> >> Appreciate any pointer. >> >> Thanks and regards, >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code.