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
+4.5k Javascript : Shuffle or randomize array example
+7.4k Golang : Generate Datamatrix barcode
+4.7k Golang : Grab news article text and use NLP to get each paragraph's sentences
+9.4k Golang : How to delete element(data) from map ?
+12.8k Golang : How to check if your program is running in a terminal
+14.6k Golang : Update database with GORM example
+25.5k PHP : Convert(cast) string to bigInt
+6.3k Golang : Process json data with Jason package
+13.9k Golang : How to get Unix file descriptor for console and file
+11.8k Golang : Convert IPv4 address to packed 32-bit binary format
+5.6k Golang : Spell checking with ispell example
+19.2k Golang : Underscore or snake_case to camel case example