1 Star 0 Fork 0

余济舟/aid

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
filesystem.go 1021 Bytes
一键复制 编辑 原始数据 按行查看 历史
余济舟 提交于 2025-09-16 09:10 +08:00 . [feature]filesystem/v2更名filesystemV2
package filesystemV2
import (
"path/filepath"
"gitee.com/jericho-yu/aid/array"
)
func getRootPath(dir string) string {
rootPath, _ := filepath.Abs(".")
return filepath.Clean(filepath.Join(rootPath, dir))
}
// CopyFiles 批量复制文件
func CopyFiles(srcFiles, dstFiles *array.AnyArray[*File]) {
srcFiles.Each(func(idx int, item *File) { item.CopyTo(dstFiles.Get(idx).GetFullPath()) })
}
// CopyFilesByDstPath 批量复制文件:通过dst绝对路径(无法指定拷贝后的文件名)
func CopyFilesByDstPath(srcFiles *array.AnyArray[*File], dstPath string) {
dstFiles := array.Make[*File](srcFiles.Len())
srcFiles.Each(func(idx int, item *File) { dstFiles.Set(idx, FileApp.NewByAbs(filepath.Join(dstPath, item.GetName()))) })
CopyFiles(srcFiles, dstFiles)
}
// CopyFilesBy2Path 批量复制文件:通过src绝对路径到dst绝对路径(无法指定拷贝后的文件名)
func CopyFilesBy2Path(srcPath, dstPath string) {
CopyFilesByDstPath(DirApp.NewByAbs(srcPath).GetFiles(), dstPath)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jericho-yu/aid.git
git@gitee.com:jericho-yu/aid.git
jericho-yu
aid
aid
v1.45.13

搜索帮助