|
@@ -134,7 +134,7 @@ public class CosFileService extends AbstractFYunFileService {
|
|
|
public void downloadFileByCommand(String bucket, String filePath, String remoteFilePath) {
|
|
|
try {
|
|
|
String optType = remoteFilePath.contains(".") ? "file" : "folder";
|
|
|
- String command = String.format(fYunConstants.DOWNLOAD_SH, bucket, remoteFilePath, filePath, FYunTypeEnum.OSS.code(), optType);
|
|
|
+ String command = String.format(fYunConstants.DOWNLOAD_SH, bucket, remoteFilePath, filePath, FYunTypeEnum.COS.code(), optType);
|
|
|
log.info("开始下载文件, ossPath:{}, srcPath:{}", remoteFilePath, filePath);
|
|
|
callshell(command);
|
|
|
log.info("下载文件完毕, ossPath:{}, srcPath:{}", remoteFilePath, filePath);
|
|
@@ -144,6 +144,20 @@ public class CosFileService extends AbstractFYunFileService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void downloadByCommand(String bucket, String filePath, String remoteFilePath, boolean isDir) {
|
|
|
+ try {
|
|
|
+ String optType = isDir ? "folder" : "file";
|
|
|
+ String command = String.format(fYunConstants.DOWNLOAD_SH, bucket, remoteFilePath, filePath, FYunTypeEnum.COS.code(), optType);
|
|
|
+ log.info("开始下载文件, ossPath:{}, srcPath:{}", remoteFilePath, filePath);
|
|
|
+ callshell(command);
|
|
|
+ log.info("下载文件完毕, ossPath:{}, srcPath:{}", remoteFilePath, filePath);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(String.format("下载文件失败, ossPath:%s, srcPath:%s", remoteFilePath, filePath), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
public void deleteFile(String bucket, String remoteFilePath) throws IOException {
|
|
|
try {
|
|
|
cosClient.deleteObject(bucket, remoteFilePath);
|