func HardLinkFiles(srcDir, dstDir string) error {
	if err := os.MkdirAll(dstDir, 0755); err != nil {
		return fmt.Errorf("cannot create dstDir=%q: %s", dstDir, err)
	}

	d, err := os.Open(srcDir)
	if err != nil {
		return fmt.Errorf("cannot open srcDir=%q: %s", srcDir, err)
	}
	defer func() {
		if err := d.Close(); err != nil {
			logger.Panicf("FATAL: cannot close %q: %s", srcDir, err)
		}
	}()

	fis, err := d.Readdir(-1)
	if err != nil {
		return fmt.Errorf("cannot read files in scrDir=%q: %s", srcDir, err)
	}
	for _, fi := range fis {
		if IsDirOrSymlink(fi) {
			// Skip directories.
			continue
		}
		fn := fi.Name()
		srcPath := srcDir + "/" + fn
		dstPath := dstDir + "/" + fn
		if err := os.Link(srcPath, dstPath); err != nil {
			return err
		}
	}

	SyncPath(dstDir)
	return nil
}
// HardLinkFiles makes hard links for all the files from srcDir in dstDir.
HardLinkFiles makes hard links for all the files from srcDir in dstDir.
// HardLinkFiles makes hard links for all the files from srcDir in dstDir .
func HardLinkFiles(srcDir, dstDir string) error {
	if err := os.MkdirAll(dstDir, 0755); err != nil {
		return fmt.Errorf("cannot create dstDir=%q: %s", dstDir, err)
	}
	d, err := os.Open(srcDir)
	if err != nil {
		return fmt.Errorf("cannot open srcDir=%q: %s", srcDir, err)
	}
	defer func() {
		if err := d.Close(); err != nil {
			logger.Panicf("FATAL: cannot close %q: %s", srcDir, err)
		}
	}()
	fis, err := d.Readdir(-1)
	if err != nil {
		return fmt.Errorf("cannot read files in scrDir=%q: %s", srcDir, err)
	}
	for _, fi := range fis {
		if IsDirOrSymlink(fi) {
			continue
		}
		fn := fi.Name()
		srcPath := srcDir + "/" + fn
		dstPath := dstDir + "/" + fn
		if err := os.Link(srcPath, dstPath); err != nil {
			return err
		}
	}
	SyncPath(dstDir)
	return nil
}
func HardLinkFiles ( srcDir , dstDir string ) error { if err := os . MkdirAll ( dstDir , 0755 ) ; err != nil { return fmt . Errorf ( " " , dstDir , err ) } d , err := os . Open ( srcDir ) if err != nil { return fmt . Errorf ( " " , srcDir , err ) } defer func ( ) { if err := d . Close ( ) ; err != nil { logger . Panicf ( " " , srcDir , err ) } } ( ) fis , err := d . Readdir ( - 1 ) if err != nil { return fmt . Errorf ( " " , srcDir , err ) } for _ , fi := range fis { if IsDirOrSymlink ( fi ) { continue } fn := fi . Name ( ) srcPath := srcDir + " " + fn dstPath := dstDir + " " + fn if err := os . Link ( srcPath , dstPath ) ; err != nil { return err } } SyncPath ( dstDir ) return nil }
HardLinkFiles makes hard links for all the files from srcDir in dstDir.
HardLinkFiles makes hard links for all the files from srcDir in dstDir .
// Skip directories.