func RemoveDirContents(dir string) {
	if !IsPathExist(dir) {
		// The path doesn't exist, so nothing to remove.
		return
	}
	d, err := os.Open(dir)
	if err != nil {
		logger.Panicf("FATAL: cannot open dir %q: %s", dir, err)
	}
	defer MustClose(d)
	names, err := d.Readdirnames(-1)
	if err != nil {
		logger.Panicf("FATAL: cannot read contents of the dir %q: %s", dir, err)
	}
	for _, name := range names {
		if name == "." || name == ".." || name == "lost+found" {
			// Skip special dirs.
			continue
		}
		fullPath := dir + "/" + name
		if err := os.RemoveAll(fullPath); err != nil {
			logger.Panicf("FATAL: cannot remove %q: %s", fullPath, err)
		}
	}
	SyncPath(dir)
}
// RemoveDirContents removes all the contents of the given dir it it exists.
//
// It doesn't remove the dir itself, so the dir may be mounted
// to a separate partition.
RemoveDirContents removes all the contents of the given dir it it exists.

It doesn't remove the dir itself, so the dir may be mounted
to a separate partition.
// RemoveDirContents removes all the contents of the given dir it it exists . // // It doesn ' t remove the dir itself so the dir may be mounted // to a separate partition .
func RemoveDirContents(dir string) {
	if !IsPathExist(dir) {
		return
	}
	d, err := os.Open(dir)
	if err != nil {
		logger.Panicf("FATAL: cannot open dir %q: %s", dir, err)
	}
	defer MustClose(d)
	names, err := d.Readdirnames(-1)
	if err != nil {
		logger.Panicf("FATAL: cannot read contents of the dir %q: %s", dir, err)
	}
	for _, name := range names {
		if name == "." || name == ".." || name == "lost+found" {
			continue
		}
		fullPath := dir + "/" + name
		if err := os.RemoveAll(fullPath); err != nil {
			logger.Panicf("FATAL: cannot remove %q: %s", fullPath, err)
		}
	}
	SyncPath(dir)
}
func RemoveDirContents ( dir string ) { if ! IsPathExist ( dir ) { return } d , err := os . Open ( dir ) if err != nil { logger . Panicf ( " " , dir , err ) } defer MustClose ( d ) names , err := d . Readdirnames ( - 1 ) if err != nil { logger . Panicf ( " " , dir , err ) } for _ , name := range names { if name == " " || name == " " || name == " " { continue } fullPath := dir + " " + name if err := os . RemoveAll ( fullPath ) ; err != nil { logger . Panicf ( " " , fullPath , err ) } } SyncPath ( dir ) }
RemoveDirContents removes all the contents of the given dir it it exists.
RemoveDirContents removes all the contents of the given dir it it exists .
// The path doesn't exist, so nothing to remove. // Skip special dirs.