Skip to content

Instantly share code, notes, and snippets.

@jensmeder
Last active November 11, 2019 18:28
Show Gist options
  • Save jensmeder/11b6bb22d60a998904f07ce6d0d58bbd to your computer and use it in GitHub Desktop.
Save jensmeder/11b6bb22d60a998904f07ce6d0d58bbd to your computer and use it in GitHub Desktop.
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.Map;
import java.util.List;
public class Photos {
private final Path source;
private final Path destination;
public Photos(String source, Path destination) {
this(Path.of(source), destination);
}
public Photos(String source, String destination) {
this(Path.of(source), Path.of(destination));
}
public Photos(Path source, Path destination) {
this.source = source;
this.destination = destination;
}
public String[] list() throws SecurityException {
return this.source.toFile().list((dir, name) -> name.toLowerCase().endsWith(".jpeg"));
}
public void importAll() throws IOException {
Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment