mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: recording folder deletion with FileUtils
parent
9a59ddc385
commit
ae778b0c13
|
@ -38,6 +38,7 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.ws.rs.ProcessingException;
|
import javax.ws.rs.ProcessingException;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.kurento.client.MediaProfileSpecType;
|
import org.kurento.client.MediaProfileSpecType;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -329,14 +330,12 @@ public class RecordingManager {
|
||||||
File[] files = folder.listFiles();
|
File[] files = folder.listFiles();
|
||||||
for (int i = 0; i < files.length; i++) {
|
for (int i = 0; i < files.length; i++) {
|
||||||
if (files[i].isDirectory() && files[i].getName().equals(recordingId)) {
|
if (files[i].isDirectory() && files[i].getName().equals(recordingId)) {
|
||||||
// Correct folder. Delete all content and the folder itself
|
// Correct folder. Delete it
|
||||||
File[] allContents = files[i].listFiles();
|
try {
|
||||||
if (allContents != null) {
|
FileUtils.deleteDirectory(files[i]);
|
||||||
for (File file : allContents) {
|
} catch (IOException e) {
|
||||||
file.delete();
|
log.error("Couldn't delete folder {}", files[i].getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
files[i].delete();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue