|
@@ -16,6 +16,9 @@ func Statistics() {
|
|
path = "云盘管理/日志/华软"
|
|
path = "云盘管理/日志/华软"
|
|
getRemoteFilePath(webdav, user, secert, path, path)
|
|
getRemoteFilePath(webdav, user, secert, path, path)
|
|
|
|
|
|
|
|
+ // path := "云盘管理/日志/张金石"
|
|
|
|
+ // getRemoteFilePath(webdav, user, secert, path, path)
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
// 获取数据目录
|
|
// 获取数据目录
|
|
@@ -31,14 +34,21 @@ func getRemoteFilePath(webdav, user, secert, remote, company string) {
|
|
log.Fatal(err)
|
|
log.Fatal(err)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ m := map[string]bool{}
|
|
|
|
+
|
|
// 遍历目录结构
|
|
// 遍历目录结构
|
|
for _, entry := range entries {
|
|
for _, entry := range entries {
|
|
// log.Println(remote + "/" + entry.Name())
|
|
// log.Println(remote + "/" + entry.Name())
|
|
if entry.IsDir() {
|
|
if entry.IsDir() {
|
|
// 如果是目录,则递归遍历子目录
|
|
// 如果是目录,则递归遍历子目录
|
|
- success = readDirRecursive(client, remote+"/"+entry.Name(), success)
|
|
|
|
|
|
+ success = readDirRecursive(client, remote+"/"+entry.Name(), success, m)
|
|
} else {
|
|
} else {
|
|
|
|
+
|
|
pth := rename(client, remote+"/"+entry.Name())
|
|
pth := rename(client, remote+"/"+entry.Name())
|
|
|
|
+ if m[pth] {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ m[pth] = true
|
|
log.Println(pth)
|
|
log.Println(pth)
|
|
info, _ := client.Read(pth)
|
|
info, _ := client.Read(pth)
|
|
str := string(info)
|
|
str := string(info)
|
|
@@ -50,7 +60,7 @@ func getRemoteFilePath(webdav, user, secert, remote, company string) {
|
|
}
|
|
}
|
|
|
|
|
|
// 递归遍历目录结构
|
|
// 递归遍历目录结构
|
|
-func readDirRecursive(client *gowebdav.Client, path string, success int) int {
|
|
|
|
|
|
+func readDirRecursive(client *gowebdav.Client, path string, success int, m map[string]bool) int {
|
|
entries, err := client.ReadDir(path)
|
|
entries, err := client.ReadDir(path)
|
|
if err != nil {
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
log.Fatal(err)
|
|
@@ -58,7 +68,7 @@ func readDirRecursive(client *gowebdav.Client, path string, success int) int {
|
|
for _, entry := range entries {
|
|
for _, entry := range entries {
|
|
if entry.IsDir() {
|
|
if entry.IsDir() {
|
|
// 如果是目录,则递归遍历子目录
|
|
// 如果是目录,则递归遍历子目录
|
|
- success = readDirRecursive(client, path+"/"+entry.Name(), success)
|
|
|
|
|
|
+ success = readDirRecursive(client, path+"/"+entry.Name(), success, m)
|
|
} else {
|
|
} else {
|
|
file_path := path + "/" + entry.Name()
|
|
file_path := path + "/" + entry.Name()
|
|
if !strings.Contains(file_path, *date) {
|
|
if !strings.Contains(file_path, *date) {
|
|
@@ -66,6 +76,10 @@ func readDirRecursive(client *gowebdav.Client, path string, success int) int {
|
|
}
|
|
}
|
|
//计算成功
|
|
//计算成功
|
|
pth := rename(client, file_path)
|
|
pth := rename(client, file_path)
|
|
|
|
+ if m[pth] {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ m[pth] = true
|
|
info, _ := client.Read(pth)
|
|
info, _ := client.Read(pth)
|
|
str := string(info)
|
|
str := string(info)
|
|
// log.Println(str)
|
|
// log.Println(str)
|