// ListFilesByDateMatching gets all files from a directory that match a given
// regular expression pattern and orders them by modification date (ascending).
// Directories and symlinks are excluded from the returned list.
ListFilesByDateMatching gets all files from a directory that match a given
regular expression pattern and orders them by modification date (ascending).
Directories and symlinks are excluded from the returned list.
// ListFilesByDateMatching gets all files from a directory that match a given // regular expression pattern and orders them by modification date ( ascending ) . // Directories and symlinks are excluded from the returned list .
func ListFilesByDateMatching(directory string, pattern string) ([]os.FileInfo, error) {
	filteredFiles := []os.FileInfo{}
	filter, err := regexp.Compile(pattern)
	if err != nil {
		return filteredFiles, err
	}
	files, err := ioutil.ReadDir(directory)
	if err != nil {
		return filteredFiles, err
	}
	sort.Sort(FilesByDate(files))
	for _, file := range files {
		if file.IsDir() || file.Mode()&os.ModeSymlink == os.ModeSymlink {
			continue 
		}
		if filter.MatchString(file.Name()) {
			filteredFiles = append(filteredFiles, file)
		}
	}
	return filteredFiles, nil
}
func ListFilesByDateMatching ( directory string , pattern string ) ( [ ] os . FileInfo , error ) { filteredFiles := [ ] os . FileInfo { } filter , err := regexp . Compile ( pattern ) if err != nil { return filteredFiles , err } files , err := ioutil . ReadDir ( directory ) if err != nil { return filteredFiles , err } sort . Sort ( FilesByDate ( files ) ) for _ , file := range files { if file . IsDir ( ) || file . Mode ( ) & os . ModeSymlink == os . ModeSymlink { continue } if filter . MatchString ( file . Name ( ) ) { filteredFiles = append ( filteredFiles , file ) } } return filteredFiles , nil }
ListFilesByDateMatching gets all files from a directory that match a given
regular expression pattern and orders them by modification date (ascending).
ListFilesByDateMatching gets all files from a directory that match a given regular expression pattern and orders them by modification date ( ascending ) .
// ### continue, skip symlinks and directories ###