// Move directory content from one path to another.
Move directory content from one path to another.
// Move directory content from one path to another .
func MoveDir(fromPath, toPath string) error {
	err := CreateDirIfNotExist(toPath)
	if err != nil {
		return err
	}
	files, err := ListFiles(fromPath, true)
	if err != nil {
		return err
	}
	for _, v := range files {
		dir, err := IsDirExists(v, true)
		if err != nil {
			return err
		}
		if dir {
			toPath := toPath + GetFileSeparator() + filepath.Base(v)
			err := MoveDir(v, toPath)
			if err != nil {
				return err
			}
			continue
		}
		err = MoveFile(v, filepath.Join(toPath, filepath.Base(v)))
		if err != nil {
			return err
		}
	}
	return err
}
func MoveDir ( fromPath , toPath string ) error { err := CreateDirIfNotExist ( toPath ) if err != nil { return err } files , err := ListFiles ( fromPath , true ) if err != nil { return err } for _ , v := range files { dir , err := IsDirExists ( v , true ) if err != nil { return err } if dir { toPath := toPath + GetFileSeparator ( ) + filepath . Base ( v ) err := MoveDir ( v , toPath ) if err != nil { return err } continue } err = MoveFile ( v , filepath . Join ( toPath , filepath . Base ( v ) ) ) if err != nil { return err } } return err }
Move directory content from one path to another.
Move directory content from one path to another .