Advertisement
Guest User

guess what this does

a guest
Sep 1st, 2015
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1.     public static void main(String[]args) {
  2.        
  3.         String[] args1={"0660", "0661", "0662", "0686", "0734", "0754", "0770","0762",
  4.                 "0766","0803", "0806", "0802", "0844", "0856", "0858", "0853", "0866",
  5.                 "0887", "0893","0918", "0921", "1051", "1037", "1040", "1053", "1058", "1107", "1111",
  6.                 "1113",  "1143", "1160", "1218", "1256", "0646", "1331", "1338", "1340", "1373", "1380",
  7.                 "1388", "1428", "1444", "1446", "1448", "1455", "1458", "1495", "1505", "1543", "1554", "1575", "1579"};
  8.        
  9.        
  10.        
  11.         File source = new File("D:\\");
  12.         File target = new File("B:\\pops/");
  13.        
  14.         String[] fileName = source.list();
  15.         File[] files = source.listFiles();//corresponding 1-1
  16.        
  17.         for (int i=0 ; i<args1.length ; i++) {
  18.        
  19.             for (int j=0 ; j<fileName.length ; j++) {
  20.                
  21.                 if (fileName[j].contains(args1[i])){//compare file names {
  22.                     File temp = new File(target.toPath()+fileName[i]);
  23.                     try {
  24.                         Files.copy(files[j].toPath(),temp.toPath() );
  25.                     } catch (IOException e) {
  26.                         // TODO Auto-generated catch block
  27.                         e.printStackTrace();
  28.                         break;
  29.                     }
  30.                 }//endif
  31.                
  32.             }//end inner for
  33.            
  34.            
  35.         }//end outer for
  36.         System.out.print("job complete!");
  37.    
  38.     }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement