// dcopy is for a directory,
// with scanning contents inside the directory
// and pass everything to "copy" recursively.
dcopy is for a directory,
with scanning contents inside the directory
and pass everything to "copy" recursively.
// dcopy is for a directory // with scanning contents inside the directory // and pass everything to " copy " recursively .
func dcopy(srcdir, destdir string, info os.FileInfo) error {
	originalMode := info.Mode()
	if err := os.MkdirAll(destdir, tmpPermissionForDirectory); err != nil {
		return err
	}
	defer os.Chmod(destdir, originalMode)
	contents, err := ioutil.ReadDir(srcdir)
	if err != nil {
		return err
	}
	for _, content := range contents {
		cs, cd := filepath.Join(srcdir, content.Name()), filepath.Join(destdir, content.Name())
		if err := copy(cs, cd, content); err != nil {
			if _, ok := err.(*UnsupportedFileTypeError); ok {
				if !IgnoreUnsupportedFileTypes {
					return err
				}
			} else {
				return err
			}
		}
	}
	return nil
}
func dcopy ( srcdir , destdir string , info os . FileInfo ) error { originalMode := info . Mode ( ) if err := os . MkdirAll ( destdir , tmpPermissionForDirectory ) ; err != nil { return err } defer os . Chmod ( destdir , originalMode ) contents , err := ioutil . ReadDir ( srcdir ) if err != nil { return err } for _ , content := range contents { cs , cd := filepath . Join ( srcdir , content . Name ( ) ) , filepath . Join ( destdir , content . Name ( ) ) if err := copy ( cs , cd , content ) ; err != nil { if _ , ok := err . ( * UnsupportedFileTypeError ) ; ok { if ! IgnoreUnsupportedFileTypes { return err } } else { return err } } } return nil }
dcopy is for a directory,
with scanning contents inside the directory
and pass everything to "copy" recursively.
dcopy is for a directory with scanning contents inside the directory and pass everything to " copy " recursively .
// Make dest dir with 0755 so that everything writable. // Recover dir mode with original one. // If we encountered an unsupported file type, exit only if we don't ignore them // If any error, exit immediately