Golang : Rename directory
Just a slight variation from the tutorial on moving file to another with Golang. This tutorial will show you how to rename a directory with Go.
There you go :
package main
import (
"fmt"
"os"
)
func main() {
err := os.Rename("FolderA", "FolderB") // rename directory
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+5.6k Golang : Extract unicode string from another unicode string example
+12.9k Generate salted password with OpenSSL example
+7.4k Golang : Get today's weekday name and calculate target day distance example
+9.4k Golang : List available AWS regions
+5.7k Javascript : Get operating system and browser information
+51.6k Golang : How to get struct field and value by name
+4.8k PHP : See installed compiled-in-modules
+5.6k Golang : Function as an argument type example
+23.4k Golang : Use regular expression to validate domain name
+7.8k Golang : Qt splash screen with delay example
+5k Javascript : Change page title to get viewer attention