Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
Acclaimed Contributor.. KAKA_2 Acclaimed Contributor..
Acclaimed Contributor..
897 views

Monitoring the size of folders on a network location

Hello Experts,

 

I have a requirement to monitor the size of all available folders in a network location. i wrote simple codes in perl and for testing purpose i used path of local directory and i am able to get the size of folders but when i use the network location, size returned by it is 0.

 

use strict;
use warnings;
use File::stat;

my @scoll;

#my $path = "c:\\temp\\";
my $path = "\\\\domain.local\\users\\";

opendir DIR, $path or die $!;
my @alldir = readdir DIR;
closedir DIR;

foreach my $eachdir (@alldir) 
{
my $cpath = $path . $eachdir;
#print $cpath;
my $sEachDir = stat($cpath)->[7];
push (@scoll, $sEachDir); 

}

print "@scoll\n";

 

 Does anyone doing similar kind of monitoring? or have any suggestion to make it work?

 

Thank You.

-KAKA-

Tags (1)
0 Likes
3 Replies
Absent Member.. TamNP Absent Member..
Absent Member..

Re: Monitoring the size of folders on a network location

Hello KAKA,

It works on local directory but not for network location.
So can I know did this user local domain login when you was running script?
0 Likes
Acclaimed Contributor.. KAKA_2 Acclaimed Contributor..
Acclaimed Contributor..

Re: Monitoring the size of folders on a network location

Hello TamNP,
So can I know did this user local domain login when you was running script?
>>> i dont understand what do you mean?

There is no problem in accessing the network location. I have full access to this location.

-KAKA-
0 Likes
Acclaimed Contributor.. m_vidyasagar Acclaimed Contributor..
Acclaimed Contributor..

Re: Monitoring the size of folders on a network location


 

use strict;
use warnings;
use File::stat;

my @scoll;

my $path = "\\\\hpom9\\Users\\vidyasagar.m\\";

opendir DIR, $path or die $!;
my @alldir = readdir DIR;
closedir DIR;

foreach my $eachdir (@alldir)
{
my $cpath = $path . $eachdir;

my $sEachDir = stat($cpath)->[7];
print "$cpath $sEachDir \n";

}

- Vidyasagar Machani -

Tell me and I forget. Teach me and I remember. Involve me and I learn. -- Benjamin Franklin
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.