How can I show folder size and number of items in folder detail in Alfresco?

StackOverflow https://stackoverflow.com/questions/13489493

  •  01-12-2021
  •  | 
  •  

Domanda

I want to show folder size and number of all the subordinate files(not sub-folders) for each folder in Alfresco Share.

How can I show this information on Folder Details as the following?

Name: Alfresco

Title: Alfresco Share

Description: Alfresco Discussion

Creator: admin

Size: 128,08 MB

Files: 12

Sub-Folders: 2

È stato utile?

Soluzione

Try with this:

    System.IO.DirectoryInfo info = new DirectoryInfo("c:\\");
    int NumerSubDirs = info.GetDirectories().Length;
    int NumFiles = info.GetFiles().Length;
    FileInfo[] fileinfos = info.GetFiles();
    float totalSize =0;

    foreach (FileInfo infof in fileinfos)
    {
      totalSize += (infof.Length / 1024 / 1024);
    }

    Console.WriteLine("Number of subdirs -> " + NumerSubDirs.ToString());
    Console.WriteLine("Numer of files -> " + NumFiles.ToString());
     Console.Write("Size of files -> " + totalSize.ToString());
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top