How to calculate average size of file in a folder using LINQ in UiPath

Problem Statement: We need to find the average file size in a folder selected by user at run time

Sample

Here is how you can do it.

Drag the assign activity to the project workflow and write the following code

GetFiles

This method is used to get the files from the folder selected by the user and extracts the files present in the parent folder. However, you can apply other arguments to this method to get the file based on extension and within sub-folders

This query uses the FileInfo class to get the length of the file and then does the average

Here is the complete solution to this video

YouTube: How to calculate average size of file in a folder using LINQ in UiPath - YouTube

You can download the code here : UiPathSamples/12 - Calculate Average size of file in a folder at main · manojbatra071/UiPathSamples · GitHub

Medium: How to calculate average size of file in a folder using LINQ in UiPath - Manoj Batra - Medium

Happy Automation