代码拉取完成,页面将自动刷新
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)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。