package leigh.notek.app;

import leigh.mecha.log.MechaLogger;
import leigh.mecha.log.MechaLoggerFactory;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.function.Consumer;

public class FileFixer {
    private static final MechaLogger logger = MechaLoggerFactory.getLogger(FileFixer.class);

    public static void main(String args[]) throws IOException {
        Files.walk(Path.of("/Users/aleigh/Desktop/zzz")).forEach(new Consumer<Path>() {
            @Override
            public void accept(Path path) {
                if (!path.toFile().isFile()) return;
                String fn[] = path.getFileName().toString().split(" ");
                Path np = (Path.of("/tmp/" + fn[0] + ".md"));
                logger.info("New FN: {}", np);
                path.toFile().renameTo(np.toFile().getAbsoluteFile());
            }
        });
    }
}
