Beispiel #1
0
        //Get number of files in folder
        public int GetNumberOfFiles()
        {
            int num = 0;

            try
            {
                num = AllFiles.EnumerateFiles().Where(fileinfo => fileinfo.Name.EndsWith(".pdf") ||
                                                      fileinfo.Name.EndsWith(".doc") ||
                                                      fileinfo.Name.EndsWith(".docx")
                                                      ).Count();
            }
            catch (DirectoryNotFoundException de)
            {
                Console.WriteLine("Error: {0}", de.Message);
            }
            return(num);
        }
Beispiel #2
0
 //Print All document names
 public void PrintAllfiles()
 {
     AllFiles.EnumerateFiles().ToList().ForEach(fileinfo =>
                                                { Console.WriteLine(fileinfo.Name.Split(new char[] { '.' })[0]); });
 }
Beispiel #3
0
        //Get document ids
        public IEnumerable <string> GetAllFiles()
        {
            IEnumerable <string> files = AllFiles.EnumerateFiles().Select(fileinfo => fileinfo.Name /*.Split(new char[] { '.'})[0]*/);

            return(files);
        }