Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A quick test to read the OneDrive Folder in the current user's home directory. (Based off of:
package main
import (
func readCurrentDir() {
usr, err := user.Current()
if err != nil {
log.Fatal( err )
fmt.Println("User's Home Directory: " + usr.HomeDir + "\n")
file, err := os.Open(usr.HomeDir + "\\OneDrive")
if err != nil {
log.Fatalf("failed opening directory: %s", err)
defer file.Close()
list,_ := file.Readdirnames(0) // 0 to read all files and folders
for _, name := range list {
func main() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.