Created
July 20, 2019 00:06
-
-
Save parzibyte/12b7ab8dae218aa5a3a9e62bc3fa1364 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func crearDirectorioSiNoExiste(directorio string) { | |
if _, err := os.Stat(directorio); os.IsNotExist(err) { | |
err = os.Mkdir(directorio, 0755) | |
if err != nil { | |
// Aquí puedes manejar mejor el error, es un ejemplo | |
panic(err) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment