Documentation
¶
Overview ¶
cmd/root.go
Index ¶
- Constants
- func BytesMD5(data []byte) string
- func CalcMD5(filePath string) string
- func CheckFileExists(filePath string) bool
- func CopyDir(src string, dst string) error
- func CountChildren(dirPath string) (int, int, int, int)
- func CreateDirIfNotExists(path string) error
- func CreateParentDirectories(filePath string) error
- func DeduplicateUintSlice(slice []uint, sortFlag int) []uint
- func DeleteFileOrDir(path string) error
- func DirExists(filePath string) bool
- func Execute()
- func ExpandWildcards(pattern string) ([]string, error)
- func ExpandWildcardsWithFilter(pattern string, filterFileTypes []string) ([]string, error)
- func FileExists(filePath string) bool
- func FileMD5(filePath string) string
- func FileSHA1(filePath string) string
- func FileSHA256(filePath string) string
- func FilterFileTypes(paths []string, filterFileTypes []string) ([]string, error)
- func FilterFileTypesV1(paths []string, filterFileTypes []string) ([]string, error)
- func GenerateRandomString() string
- func GenerateUniqueFilePath(filePath string) string
- func GetAbsolutePath(dirPath, path string) string
- func GetChildrenList(dirPath string, relativePath bool) []string
- func GetDirList(dirPath string, relativePath bool) []string
- func GetFileHeaderHash(path string, limit int64) (uint32, error)
- func GetFileList(dirPath string, relativePath bool) []string
- func GetFileSize(path string) int64
- func GetFileSizeV2(path string) (int64, error)
- func GetFileSizeV8(path string) (int64, error)
- func GetRelativePath(dirPath, path string) (string, error)
- func GetRelativePathV1(path, dirPath string) string
- func GetRootFiles(dirPath string, relativePath bool, filterFileTypes []string) []string
- func GetStdSizeInfo(size int64) string
- func I2C(num int) string
- func IntToChars(num int) string
- func IsTmpFileOrNotExists(filePath string) bool
- func JoinUintSlice(slice []uint, sep string) string
- func Percent(a, b int) int
- func PercentChars(a, b int) string
- func PercentText(a, b int) string
- func ReadDirAndIgnoreTmpFiles(dirPath string) []os.DirEntry
- func SortUintSlice(slice []uint, sortFlag int) []uint
- func StringMD5(str string) string
- type FileInfo
Constants ¶
const AppVersion = "1.0.0"
const H = "💯"
const NUMBER_CHARS = "0️⃣1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣8️⃣9️⃣"
const NUMBER_CHARS_ALL = "0️⃣1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣8️⃣9️⃣🔟"
Variables ¶
This section is empty.
Functions ¶
func CheckFileExists ¶
func CreateDirIfNotExists ¶
func CreateParentDirectories ¶
CreateParentDirectories 创建给定文件路径的所有父级文件夹
func DeduplicateUintSlice ¶
DeduplicateUintSlice 删除重复元素. 可选是否对结果排序 slice: 待处理的切片 sortFlag: 0-不排序, 1-升序, 2-降序
func ExpandWildcards ¶
ExpandWildcards 接收一个可能包含通配符的路径字符串,并返回所有匹配的文件路径列表。
func ExpandWildcardsWithFilter ¶
ExpandWildcardsWithFilter 接收一个可能包含通配符的路径字符串,并返回所有匹配的文件路径列表。支持传入要过滤文件类型(例如: .png .jpg)
func FileExists ¶
func FilterFileTypes ¶
FilterFileTypes 过滤 []string 文件类型
func FilterFileTypesV1 ¶
func GenerateRandomString ¶
func GenerateRandomString() string
func GenerateUniqueFilePath ¶
GenerateUniqueFilePath 生成唯一的文件路径,通过在文件名后添加 _1, _2 等序号直到找到可用路径
func GetAbsolutePath ¶
func GetChildrenList ¶
GetChildrenList 获取文件夹下的所有文件和文件夹 如果输入参数 relativePath 为 true, 则返回相对于根文件夹的相对路径, 否则返回绝对路径
func GetDirList ¶
GetDirList 根据输入的文件夹路径, 输出一个文件夹列表(该文件夹内所有层级的文件夹在系统的绝对完整路径,不包括文件)
func GetFileHeaderHash ¶
GetFileHeaderHash 获取文件的头部Hash
func GetFileList ¶
GetFileList 根据输入的文件夹路径, 输出一个文件列表(该文件夹内所有层级的文件在系统的绝对完整路径,不包括文件夹)
func GetFileSize ¶
func GetFileSizeV2 ¶
func GetFileSizeV8 ¶
func GetRelativePath ¶
获取 path 相对于 dirPath 的相对路径
func GetRootFiles ¶
GetRootFiles 获取指定目录下根目录中的文件列表 dirPath: 要遍历的目录路径 relativePath: 如果非空,则返回相对于此路径的相对路径;否则返回绝对路径 filterFileTypes: 要过滤的文件后缀名列表(如 ".txt", ".jpg"),为空或 nil 表示不过滤
func GetStdSizeInfo ¶
func IntToChars ¶
func IsTmpFileOrNotExists ¶
func JoinUintSlice ¶
func PercentChars ¶
func PercentText ¶
func SortUintSlice ¶
SortUintSlice 对切片排序 slice: 待处理的切片 sortFlag: 排序标志,1表示升序,2表示降序. 其他数值比如0表示不排序