Welcome To Golang By Example

Menu
  • Home
  • Blog
  • Contact Us
  • Support this website
Menu

Tag: directory

Get Current User’s Home Directory in Go (Golang)

Posted on April 17, 2020April 17, 2020 by admin

Overview ‘os/user’ package can be used to get the current user home directory Let’s see a working code Code Output

Change folder/directory permissions in Go (Golang)

Posted on April 17, 2020April 17, 2020 by admin

os.Chmod() function can be used to change the permissions of an existing folder or directory. Below is the signature of the function Code Output:

Create a directory or folder in Go (Golang)

Posted on April 16, 2020April 16, 2020 by admin

Overview os.Mkdir() function can be used to create a directory or folder in go. Below is the signature of the function. It takes in two parameters The first parameter is the named…

Get Current Working Directory in Go (Golang)

Posted on January 16, 2020January 16, 2020 by admin

os.Getwd() is used to get the current working directory. Output will similar to pwd command on linux Output: Current Working Direcoty: <will be current working directory on the machine>

Check if file is a directory or not in Go (Golang)

Posted on January 15, 2020January 15, 2020 by admin

See the below code to know if a file is a file or it is a directory If temp is a file output will be = “temp is a file” If temp…

Check if a file or directory exists in Go (Golang)

Posted on January 15, 2020October 4, 2021 by admin

os.Stat and os.IsNotExist() can be used to check whether a particular file or directory exist or not. File Exists    Folder Exists

Follow @golangbyexample

Popular Articles

Golang Comprehensive Tutorial Series

All Design Patterns in Go (Golang)

Slice in golang

Variables in Go (Golang) – Complete Guide

OOP: Inheritance in GOLANG complete guide

Using Context Package in GO (Golang) – Complete Guide

All data types in Golang with examples

Understanding time and date in Go (Golang) – Complete Guide

©2025 Welcome To Golang By Example | Design: Newspaperly WordPress Theme