1 package eu.svjatoslav.meviz.htmlindexer.indexer;
3 import eu.svjatoslav.commons.file.IOHelper;
4 import eu.svjatoslav.meviz.htmlindexer.CommandlineHandler;
5 import eu.svjatoslav.meviz.htmlindexer.layouts.Layout;
6 import eu.svjatoslav.meviz.htmlindexer.Utils;
9 import java.io.IOException;
11 public class FilesystemIndexRemover {
13 private final CommandlineHandler commandlineHandler;
15 public FilesystemIndexRemover(final CommandlineHandler commandlineHandler)
17 this.commandlineHandler = commandlineHandler;
19 removeIndex(commandlineHandler.getWorkingDirectory());
22 private void removeIndex(final File workingDirectory) throws IOException {
24 // remove thumbnails directory from current directory
25 final File thumbnailsDirectory = Utils
26 .getThumbnailsDirectory(workingDirectory);
27 if (thumbnailsDirectory.exists()) {
28 System.out.println("Deleting thumbnails directory: "
29 + thumbnailsDirectory);
30 IOHelper.deleteRecursively(thumbnailsDirectory);
33 // recursively remove thumbnail directories from sub directories
34 File[] files = workingDirectory.listFiles();
36 for (final File subFile : files)
37 if (subFile.isDirectory())
40 for (final Layout layout : Utils.getLayouts()) {
41 final File indexFile = Utils.getLayoutIndexFile(layout,
44 if (indexFile.exists())
45 if (Utils.isMevizGeneratedIndexFile(indexFile)) {
46 System.out.println("Deleting generated index file: "