Go的文件夹操作

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 获取当前工作目录
wdPath, err := os.Getwd()
if err != nil {
panic(err)
}
// 路径join
vDir := path.Join(wdPath, "path1", "path2")
// 创建目录
os.Mkdir(vDir, os.ModePerm)
// 获取当前工作目录 wdPath, err := os.Getwd() if err != nil { panic(err) } // 路径join vDir := path.Join(wdPath, "path1", "path2") // 创建目录 os.Mkdir(vDir, os.ModePerm)
// 获取当前工作目录
wdPath, err := os.Getwd()
if err != nil {
    panic(err)
}

// 路径join
vDir := path.Join(wdPath, "path1", "path2")

// 创建目录
os.Mkdir(vDir, os.ModePerm)

 

Leave a Reply

Your email address will not be published. Required fields are marked *