Skip to content

Instantly share code, notes, and snippets.

@afinlay5
Created July 10, 2018 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afinlay5/5b1422432f692afeffd35c0cd2a7258c to your computer and use it in GitHub Desktop.
Save afinlay5/5b1422432f692afeffd35c0cd2a7258c to your computer and use it in GitHub Desktop.
Script I used to rename and move photos.
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