filepathpkg

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

README

filepath

遍历目录、读取目录内容、创建目录和重建目录。

基础用法

paths, entries, err := filepathpkg.WalkDir("./docs")
err = filepathpkg.CreateDir("./runtime")

注意事项

路径判断受当前工作目录影响;RenewDir 会删除并重建目录,只对受控临时目录使用。

验证

go test ./filepath

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDir

func CreateDir(destDir string) (err error)

CreateDir 创建目录

func ReadDir deprecated

func ReadDir(rootPath string) (fileInfos []os.FileInfo, err error)

Deprecated: 使用 ReadDirEntries 替代

func ReadDirEntries

func ReadDirEntries(rootPath string) ([]fs.DirEntry, error)

ReadDirEntries 读取目录内容(使用 os.ReadDir)

func RenewDir

func RenewDir(destDir string) (err error)

RenewDir 重建目录

func WaldDir deprecated

func WaldDir(rootPath string) (filePaths []string, fileInfos []os.FileInfo, err error)

Deprecated: 拼写错误,使用 WalkDir 替代。 注意:返回类型从 []os.FileInfo 变为 []fs.DirEntry,此兼容函数保留原签名。

func WalkDir

func WalkDir(rootPath string) (filePaths []string, dirEntries []fs.DirEntry, err error)

WalkDir 遍历所有的目录与文件(使用 filepath.WalkDir + fs.DirEntry)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL