directory

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, des string) error

CopyFile 使用io.Copy进行文件的复制,同时也会复制文件的所有权限 @param src 复制文件 @param des 目标文件 @return error 错误信息

func CreateDir

func CreateDir(dirpath string) error

CreateDir 创建文件夹

func Delete

func Delete(path string) error

Delete 文件夹/文件通用删除方法

func GetPerm

func GetPerm(path string) error

GetPerm 获取win管理员(admin)权限

func IsExist

func IsExist(path string) bool

IsExist 判断是否存在

Types

type Directory

type Directory struct {
	Path string
	Name string
}

func OpenDir

func OpenDir(path string) *Directory

OpenDir 打开文件夹

func (*Directory) Copy

func (d *Directory) Copy(targetDir string) error

Copy 复制文件夹

func (*Directory) Delete

func (d *Directory) Delete() error

Delete 删除当前文件夹的所有内容

func (*Directory) GetALLDir

func (d *Directory) GetALLDir() []*Directory

GetALLDir 获取当前目录所有的子文件夹

func (*Directory) GetAllFile

func (d *Directory) GetAllFile(isSearchSubDir bool) []*file.File

GetAllFile 获取当前目录所有的子文件夹

func (*Directory) GetChildrenDirs

func (d *Directory) GetChildrenDirs() []Directory

GetChildrenDirs 获取子文件夹

func (*Directory) GetDir

func (d *Directory) GetDir(name string) ([]*Directory, error)

GetDir 通过文件夹名获取文件夹

func (*Directory) GetFile

func (d *Directory) GetFile(name string) ([]*file.File, error)

GetFile 通过文件名获取文件

func (*Directory) GetFilesAll

func (d *Directory) GetFilesAll() []file.File

GetFilesAll 获取文件夹中的文件(包含子文件夹)

func (*Directory) GetParent

func (d *Directory) GetParent() *Directory

GetParent 获取父级文件夹路径

func (*Directory) IsExist

func (d *Directory) IsExist() bool

IsExist 判断是否存在

func (*Directory) Move

func (d *Directory) Move(targetDir string) error

Move 移动文件夹

func (*Directory) Rename

func (d *Directory) Rename(newName string) error

Rename 重命名文件夹

Jump to

Keyboard shortcuts

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