mirror of
https://gitee.com/zhangsken/aliyunpan.git
synced 2026-10-16 02:23:49 +08:00
sort by file name for download file list
This commit is contained in:
@@ -33,6 +33,7 @@ import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -397,6 +398,12 @@ func RunDownload(paths []string, options *DownloadOptions) {
|
||||
fmt.Printf("文件不存在: %s\n", paths[k])
|
||||
continue
|
||||
}
|
||||
// 排序,按名称排序,从小到大
|
||||
sort.Slice(fileList, func(i, j int) bool {
|
||||
return fileList[i].FileName < fileList[j].FileName
|
||||
})
|
||||
// 逐一下载
|
||||
|
||||
for _, f := range fileList {
|
||||
newCfg := *cfg
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -552,6 +553,10 @@ func (dtu *DownloadTaskUnit) Run() (result *taskframework.TaskUnitRunResult) {
|
||||
}
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
// 排序,按名称排序,从小到大
|
||||
sort.Slice(fileList, func(i, j int) bool {
|
||||
return fileList[i].FileName < fileList[j].FileName
|
||||
})
|
||||
// 创建对应的任务进行下载
|
||||
for k := range fileList {
|
||||
fileList[k].Path = path.Join(dtu.FilePanPath, fileList[k].FileName)
|
||||
|
||||
Reference in New Issue
Block a user