func FileCRC32(path string) (uint32, error) {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		return 0, err
	}
	return crc32.ChecksumIEEE(data), nil
}
FileCRC32 returns the checksum of a given file
package tio
import (
	"hash/crc32"
	"io/ioutil"
	"os"
	"path/filepath"
	"regexp"
	"sort"
	"strings"
)
type FilesByDate []os.FileInfo
func (files FilesByDate) Len() int {
	return len(files)
}
func (files FilesByDate) Swap(a, b int) {
	files[a], files[b] = files[b], files[a]
}
func (files FilesByDate) Less(a, b int) bool {
	timeA, timeB := files[a].ModTime().UnixNano(), files[b].ModTime().UnixNano()
	if timeA == timeB {
		return files[a].Name() < files[b].Name()
	}
	return timeA < timeB
}
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 SplitPath(filePath string) (dir string, base string, ext string) {
	dir = filepath.Dir(filePath)
	ext = filepath.Ext(filePath)
	base = filepath.Base(filePath)
	base = base[:len(base)-len(ext)]
	return dir, base, ext
}
func FileExists(filePath string) bool {
	_, err := os.Lstat(filePath)
	return !os.IsNotExist(err)
}
func IsDirectory(filePath string) bool {
	stat, err := os.Stat(filePath)
	if err != nil {
		return false
	}
	return stat.IsDir()
}
func CommonPath(path1, path2 string) string {
	parts1 := strings.Split(path1, "/")
	parts2 := strings.Split(path2, "/")
	maxIdx := len(parts1)
	if len(parts2) < maxIdx {
		maxIdx = len(parts2)
	}
	common := make([]string, 0, maxIdx)
	for i := 0; i < maxIdx; i++ {
		if parts1[i] == parts2[i] {
			common = append(common, parts1[i])
		}
	}
	return strings.Join(common, "/")
}