Skip to content

XFerion Latin America S.A.

Software Development

Recent Posts

  • golang: Check if key exists in map
  • Golang: Reverse ISOWeek, get the date of the first day of ISO week
  • Golang: measure time to execute code
  • Golang create directory
  • Golang delete file

Recent Comments

  • Abinhho on Building a Golang web application with Revel
  • stephan on Golang substr or substring equivalent
  • a-h on Golang substr or substring equivalent
  • legends2k on Golang substr or substring equivalent
  • Serhii Herasymov on Golang: Reverse ISOWeek, get the date of the first day of ISO week

Archives

  • July 2015
  • May 2015
  • February 2015
  • January 2015

Categories

  • Go Programming
  • Software Development
  • Web Programming

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Tag: os

Golang create directory

Golang create directory

Creating a directory from Google Go is simple with the “os” package. See the example below.

Golang create directory example

path := "/folder/to/create"
err := os.MkdirAll(path,0711)

if err != nil {
 log.Println("Error creating directory")
 log.Println(err)
 return
}
Posted on February 7, 2015Categories Go Programming, Software DevelopmentTags go, Golang, google go, kb, osLeave a comment on Golang create directory
Golang delete file

Golang delete file

Deleting a file from Google Go (Golang) is simple with the “os” package. See the example below.

Golang delete file example

path := "/path/to/file/to/delete"
err := os.Remove(path)

if err != nil {
  fmt.Println(err)
  return
}
Posted on February 7, 2015Categories Go Programming, Software DevelopmentTags go, Golang, google go, osLeave a comment on Golang delete file
Proudly powered by WordPress