func CopyFile(dst, src string) error {
	sf, err := os.Open(src)
	if err != nil {
		return err
	}
	defer sf.Close()
	sstat, err := sf.Stat()
	if err != nil {
		return err
	}
	if !sstat.Mode().IsRegular() {
		return errors.New("not regular file")
	}
	df, err := os.OpenFile(dst, os.O_WRONLY|os.O_TRUNC, sstat.Mode())
	if err != nil {
		return err
	}
	defer df.Close()
	_, err = io.Copy(df, sf)
	return err
}
CopyFile copies the file with path src to dst. The new file is created with
src permissions minus the fmask. 'dst' must exist and will be clobbered. This
allows for writing to a tempfile while not suffering from an overwriting race
condition. Caller is responsible for checking if src!=dst.
package main
import (
	"errors"
	"io"
	"os"
	"path/filepath"
	"sort"
	"strconv"
	"sync"
	"time"
	"github.com/yookoala/realpath"
)
func Basename(path string) string {
	if path == "" {
		return ""
	}
	path = path[len(filepath.VolumeName(path)):]
	i := len(path) - 1
	for i >= 0 && !os.IsPathSeparator(path[i]) {
		i--
	}
	if i >= 0 {
		path = path[i+1:]
	}
	return path
}