List <FileInfo> BuildFileList(params string[] searchDirs)
        {
            // Get domain regex
            var domainRegex = new Regex(PluginConfig.GetString("domain_regexp"), RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
            var userRegex   = new Regex(PluginConfig.GetString("user_regexp"), RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);

            // Weed out directories that don't exist; notify the user via logs
            var nonExistantDirs = searchDirs.Where(dir => !Directory.Exists(dir));

            foreach (var nonExistantDir in nonExistantDirs.Distinct())
            {
                Warn("Ignoring directory {0}; DOESN'T EXIST!", nonExistantDir);
            }

            // Make sure elements in list are unique
            searchDirs = searchDirs.Where(x => !nonExistantDirs.Contains(x)).Where((Func <string, bool>)domainRegex.IsMatch).Distinct().ToArray();

            var fileList = new List <FileInfo>();

            foreach (var domainDir in searchDirs)
            {
                Ok("Scanning directory {0}...", domainDir);
                var dir      = new DirectoryInfo(domainDir);
                var userDirs = dir.EnumerateDirectories().Where(x => userRegex.IsMatch(x.Name));
                Ok("Found {0} user directories in {1}...", userDirs.Count(), domainDir);

                foreach (var user in userDirs)
                {
                    Ok("Scanning user directory {0}...", user.Name);
                    var validFiles = user.EnumerateFiles().Where(

                        // Filter invalid files here

                        /************************************
                        * A file is invalid if:            *
                        * size < 128b                      *
                        * readonly = true                  *
                        * !exists                          *
                        * name is nullorwhitespace()       *
                        ************************************/

                        x => x.Exists && x.Length > 128 && !x.IsReadOnly && !string.IsNullOrWhiteSpace(x.Name)

                        ).ToList();

                    // Rename files ending with .eml to .index
                    validFiles.ForEach(file => {
                        if (file.Name.Contains(PluginConfig.GetString("post_index_file_ext")))
                        {
                            file.MoveTo(
                                string.Format(
                                    "{0}{1}",
                                    file.Name
                                    .Replace(PluginConfig.GetString("post_index_file_ext"), "")
                                    .Trim()
                                    .Trim('.'),
                                    PluginConfig.GetString("pre_index_file_ext")
                                    )
                                );
                        }
                        fileList.Add(file);
                    });
                }
            }

            return(fileList);
        }