String[] format = getPlaybackFormats(path);
for (int i = 0; i < format.length; i++) {
File[] recordings = getDirectories(path + File.separatorChar + format[i]);
for (int f = 0; f < recordings.length; f++) {
if (recordings[f].getName().equalsIgnoreCase(recordingId)) {
Recording r = getRecordingInfo(path, recordingId, format[i]);
if (r != null) {
File dest;
if (publish) {
dest = new File(publishedDir+ File.separatorChar + format[i]);
} else {
dest = new File(unpublishedDir+ File.separatorChar + format[i]);
}
if(!dest.exists()) dest.mkdir();
boolean moved = recordings[f].renameTo(new File(dest, recordings[f].getName()));
if (moved) {
log.debug("Recording successfully moved!");
r.setPublished(publish);
recordingServiceHelper.writeRecordingInfo(dest.getAbsolutePath() + File.separatorChar + recordings[f].getName(), r);
}
}
}
}