Is there any activity which reads the folder path and give you folder size

I have hundreds of folder paths on network; what i have to do that calculate these folder size and make the report. Note that these folders may contains millions of subfolders and files.

I have created work flow for this and used ‘BalaReva.DirFileSize.DirectorySize’ this custom activity which gives the folder size.
However it throws below exception for few cases;
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.”

I could not change the folder path and folder name; so we have to deal with it.
Is there any other method/activity which calculates foldersize efficiently?
or is there any other way that i can handle this situation.
Thanks!

1 Like

GetFolderSize.xaml (5.0 KB)
@gopal_1981,

Check this xaml it may help you.

3 Likes

Hi @gopal_1981

Just sharing I created a components that get some details in the file you can download and modify it if you wan’t See link below for your reference.

https://go.uipath.com/component/get-file-details

cheers :smiley:

Happy learning :smiley:

Thank you for the solution. I tried it here and provided a path where i had issue. It gave the output after running it around 8 hrs, and even after printing the result in output console, Process did not stop, after 4 hrs. of that, i stopped the process.

Hi Sarathi,
your script is very useful.
There is a way to view only display one character, like decimals?
ex:
Size in mb: 20.5
:slight_smile:
thx

1 Like

Try with the following code,

"Size in mb: " +Math.Round( ((dirInfo.EnumerateFiles("*", SearchOption.AllDirectories).Sum(Function(fi) fi.Length) / 1024F) / 1024F),1).ToString
1 Like

WoW! Thanks!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.