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
+32.7k Golang : How to check if slice or array is empty?
+11.4k Android Studio : Highlight ImageButton when pressed on example
+15k Golang : Read a file line by line
+7.3k Golang : Add build version and other information in executables
+5.9k Golang : Gargish-English language translator
+8.2k Golang : Generate EAN barcode
+31k Golang : Copy directory - including sub-directories and files
+12.4k Golang : error parsing regexp: invalid or unsupported Perl syntax
+21.5k Golang : Convert Unix timestamp to UTC timestamp
+36.8k Golang : Comparing date or timestamp
+20k Golang : Create and resolve(read) symbolic links