in reply to size of all subfolder from a network location

stat() might not work for a network file and some parts of it might not be implemented because it could be a very expensive operation, and might not succeed and/or be accurate (e.g. for a curently-open file).   Network file systems vary considerably on that point.   Although the suggestion to actually execute a dir command might or might not be the best, the principle is a good one:   use the directory entry, and hope that it is reasonably up to date.   On other systems, other commands (such as du on a Unix box) might be preferable ... and, this being Perl, I am quite sure that there’s already The Perfect CPAN Module out there.   In any case, rely on the file-size information that is posted in the directory of that filesystem, one way or the other.   Trust that it will be close-enough ... and in any case that it can more-or-less be obtained locally instead of potentially far-away.