Biz.Extensions.DirectoryExtension.GetDirSize C# (CSharp) Method

GetDirSize() public static method

public static GetDirSize ( this dir, long &size ) : void
dir this
size long
return void
        public static void GetDirSize(this string dir, ref long size)
        {
            try
            {
                string[] fileList = Directory.GetFileSystemEntries(dir);

                foreach (string file in fileList)
                {
                    if (Directory.Exists(file))
                    {
                        GetDirSize(file, ref size);
                    }
                    else
                    {
                        FileInfo fiArr = new FileInfo(file);
                        size += fiArr.Length / 1024;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
            }
        }
DirectoryExtension