[agent-operator] - add tag from gzip folder
This commit is contained in:
@@ -150,11 +150,20 @@ func FileExistAndNotNull(filename string) bool {
|
||||
return size > 0
|
||||
}
|
||||
|
||||
// ListAllFileInFolder 列出一个目录中的所有文件,返回文件名,忽略folder,不带全路径
|
||||
func ListAllFileInFolder(folderName string) ([]string, error) {
|
||||
return listAllFileInFolderWithFullPath(folderName, false)
|
||||
}
|
||||
|
||||
func listAllFileInFolderWithFullPath(folderName string, fullPath bool) ([]string, error) {
|
||||
files := make([]string, 0)
|
||||
err := filepath.Walk(folderName, func(path string, info os.FileInfo, err error) error {
|
||||
if !info.IsDir() {
|
||||
files = append(files, info.Name())
|
||||
if fullPath {
|
||||
files = append(files, path)
|
||||
} else {
|
||||
files = append(files, info.Name())
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user