|
|
@ -37,21 +37,23 @@ func (f *UpFileService) SendFileInfo(info FileInfo, reply *string) error { |
|
|
// }
|
|
|
// }
|
|
|
|
|
|
|
|
|
// 提取路径 /www/wwwroot/bidemo.com/BIU_20250918_183144.zip
|
|
|
// 提取路径 /www/wwwroot/bidemo.com/BIU_20250918_183144.zip
|
|
|
fmt.Printf("SendFileInfo fileName: %s\n", info.FileName) |
|
|
// fmt.Printf("SendFileInfo fileName: %s\n", info.FileName)
|
|
|
dirPath := filepath.Dir(info.FileName) |
|
|
dirPath := filepath.Dir(info.FileName) |
|
|
logger.Info("SendFileInfo", zap.String("dirPath", dirPath)) |
|
|
logger.Info("SendFileInfo", zap.String("dirPath", dirPath)) |
|
|
|
|
|
// *reply = fmt.Sprintf("folder: %s is exists", dirPath)
|
|
|
// 检查文件夹是否存在
|
|
|
// 检查文件夹是否存在
|
|
|
if _, err := os.Stat(dirPath); os.IsNotExist(err) { |
|
|
if _, err := os.Stat(dirPath); os.IsNotExist(err) { |
|
|
// 文件夹不存在,创建它
|
|
|
// 文件夹不存在,创建它
|
|
|
if err := os.MkdirAll(dirPath, 0755); err != nil { |
|
|
if err := os.MkdirAll(dirPath, 0755); err != nil { |
|
|
logger.Error("SendFileInfo mkdir failed", zap.Error(err)) |
|
|
logger.Error("SendFileInfo mkdir failed", zap.Error(err)) |
|
|
*reply = fmt.Sprintf("mkdir folder: %s failed", dirPath) |
|
|
// *reply = fmt.Sprintf("mkdir folder: %s failed", dirPath)
|
|
|
// return err
|
|
|
// return err
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
*reply = fmt.Sprintf("folder: %s is exists", dirPath) |
|
|
// *reply = fmt.Sprintf("folder: %s is exists", dirPath)
|
|
|
// *reply = true
|
|
|
// 返回true的字符串
|
|
|
|
|
|
*reply = "true" |
|
|
return nil |
|
|
return nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|