Created
July 10, 2018 03:14
-
-
Save afinlay5/5b1422432f692afeffd35c0cd2a7258c to your computer and use it in GitHub Desktop.
Script I used to rename and move photos.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.nio.file.Path; | |
import java.nio.file.Files; | |
import java.io.IOException; | |
public class RenamePhotos { | |
public static void main (String[] args) throws IOException { | |
try { | |
var dest = new java.io.File("/run/secret/").toPath(); | |
var photos = new java.io.File("/run/secret/blah").listFiles(); | |
for (var photo: photos) | |
Files.move( photo.toPath() , (dest.resolve("(1)"+ photo.toPath().getFileName())) ); | |
} catch (IOException ioe) { System.out.println("Crap."); System.exit(1); } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment