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 (

 func main() {

 err := os.Rename("FolderA", "FolderB") // rename directory

 if err != nil {


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.