func copyFile(src, dst string) error {
	// First create the directory just in case is not there
	last := strings.LastIndex(dst, "/")
	os.MkdirAll(dst[0:last+1], os.ModePerm)

	fmt.Println("Copy " + src)
	fmt.Println("Into " + dst[0:last+1])

	var err error
	var srcfd *os.File
	var dstfd *os.File
	var srcinfo os.FileInfo

	if srcfd, err = os.Open(src); err != nil {
		return err
	}
	defer srcfd.Close()

	if dstfd, err = os.Create(dst); err != nil {
		return err
	}
	defer dstfd.Close()

	if _, err = io.Copy(dstfd, srcfd); err != nil {
		return err
	}
	if srcinfo, err = os.Stat(src); err != nil {
		return err
	}
	fmt.Println("Copy file finished executing")

	return os.Chmod(dst, srcinfo.Mode())
}
// copyFile copies a single file from src to dst, taking care of creating the destiny directory if does not exist
// The src and the dst should be the FULL ROUTE TO THE FILE, INCLUDING THE EXTENSION
copyFile copies a single file from src to dst, taking care of creating the destiny directory if does not exist
The src and the dst should be the FULL ROUTE TO THE FILE, INCLUDING THE EXTENSION
// copyFile copies a single file from src to dst taking care of creating the destiny directory if does not exist // The src and the dst should be the FULL ROUTE TO THE FILE INCLUDING THE EXTENSION
func copyFile(src, dst string) error {
	last := strings.LastIndex(dst, "/")
	os.MkdirAll(dst[0:last+1], os.ModePerm)
	fmt.Println("Copy " + src)
	fmt.Println("Into " + dst[0:last+1])
	var err error
	var srcfd *os.File
	var dstfd *os.File
	var srcinfo os.FileInfo
	if srcfd, err = os.Open(src); err != nil {
		return err
	}
	defer srcfd.Close()
	if dstfd, err = os.Create(dst); err != nil {
		return err
	}
	defer dstfd.Close()
	if _, err = io.Copy(dstfd, srcfd); err != nil {
		return err
	}
	if srcinfo, err = os.Stat(src); err != nil {
		return err
	}
	fmt.Println("Copy file finished executing")
	return os.Chmod(dst, srcinfo.Mode())
}
func copyFile ( src , dst string ) error { last := strings . LastIndex ( dst , " " ) os . MkdirAll ( dst [ 0 : last + 1 ] , os . ModePerm ) fmt . Println ( " " + src ) fmt . Println ( " " + dst [ 0 : last + 1 ] ) var err error var srcfd * os . File var dstfd * os . File var srcinfo os . FileInfo if srcfd , err = os . Open ( src ) ; err != nil { return err } defer srcfd . Close ( ) if dstfd , err = os . Create ( dst ) ; err != nil { return err } defer dstfd . Close ( ) if _ , err = io . Copy ( dstfd , srcfd ) ; err != nil { return err } if srcinfo , err = os . Stat ( src ) ; err != nil { return err } fmt . Println ( " " ) return os . Chmod ( dst , srcinfo . Mode ( ) ) }
copyFile copies a single file from src to dst, taking care of creating the destiny directory if does not exist
The src and the dst should be the FULL ROUTE TO THE FILE, INCLUDING THE EXTENSION
copyFile copies a single file from src to dst taking care of creating the destiny directory if does not exist The src and the dst should be the FULL ROUTE TO THE FILE INCLUDING THE EXTENSION
// First create the directory just in case is not there