Skip to content

Instantly share code, notes, and snippets.

@anupammaiti
Created June 9, 2021 07:42
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 anupammaiti/5eb0a2fac941ae6b0f26675e753f746f to your computer and use it in GitHub Desktop.
Save anupammaiti/5eb0a2fac941ae6b0f26675e753f746f to your computer and use it in GitHub Desktop.
package com;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class MoveFile {
public static void main(String[] args) throws IOException {
String token1 = "";
Scanner inFile1 = new Scanner(new File("C:\\Users\\ANUPAM\\shiva\\MovePhoto\\file\\FileName.txt"))
.useDelimiter("\n");
List<String> temps = new ArrayList<String>();
while (inFile1.hasNext()) {
token1 = inFile1.next();
temps.add(token1);
}
inFile1.close();
for (String fileName : temps) {
Path temp = Files.move(
Paths.get("F:\\ImageRepositoryBridge\\Shivan's Rice Cerimony\\Raw\\All\\ANU_" + fileName.trim() + ".NEF"),
Paths.get("F:\\ImageRepositoryBridge\\Shivan's Rice Cerimony\\Raw\\Sorted\\ANU_" + fileName.trim()
+ ".NEF"));
if (temp != null) {
System.out.println("ANU_" + fileName + ".NEF Moved");
} else {
System.out.println("Failed to move :ANU_" + fileName + ".NEF");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment