// delete removes the file/folder at the given path
delete removes the file/folder at the given path
// delete removes the file / folder at the given path
func deletePath(path string) (result model.Result) {
	f, err := os.Stat(path)
	if err != nil && os.IsNotExist(err) {
		result.WasSuccessful = true
		result.Message = path + " deleted"
		return result
	} else if err != nil {
		result.WasSuccessful = false
		result.Message = err.Error()
		return result
	}
	if f.IsDir() {
		err := os.RemoveAll(path)
		if err != nil {
			result.WasSuccessful = false
			result.Message = err.Error()
			return result
		}
	} else {
		err := os.Remove(path)
		if err != nil {
			result.WasSuccessful = false
			result.Message = err.Error()
			return result
		}
	}
	result.WasSuccessful = true
	result.Message = path + " deleted"
	return result
}
func deletePath ( path string ) ( result model . Result ) { f , err := os . Stat ( path ) if err != nil && os . IsNotExist ( err ) { result . WasSuccessful = true result . Message = path + " " return result } else if err != nil { result . WasSuccessful = false result . Message = err . Error ( ) return result } if f . IsDir ( ) { err := os . RemoveAll ( path ) if err != nil { result . WasSuccessful = false result . Message = err . Error ( ) return result } } else { err := os . Remove ( path ) if err != nil { result . WasSuccessful = false result . Message = err . Error ( ) return result } } result . WasSuccessful = true result . Message = path + " " return result }
delete removes the file/folder at the given path
delete removes the file / folder at the given path
// If the file/folder does not exist there is nothing to delete // The execution only failed if the error is not due to the fact that the folder does not exist