Advertisement
gdog2u

FilesError

Apr 1st, 2014
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. package inClassWork;
  2.  
  3. import java.io.IOException;
  4. import java.nio.file.*;
  5. import java.util.*;
  6.  
  7. public class VariousTester {
  8.  
  9.     public static void main(String[] args) {
  10.         String input = "";
  11.         Path destination;
  12.         Path SOURCE =Paths.get("C:/Users");
  13.        
  14.         System.out.println("Please write a file's diretory location.");
  15.         Scanner s = new Scanner(System.in);
  16.         input = s.nextLine(); // I've been using    C:/Users/gdog2_000/Desktop/temp.txt although that file has now disappeared
  17.         destination = Paths.get(input);
  18.        
  19.         try {
  20.             Files.move(SOURCE, destination, StandardCopyOption.REPLACE_EXISTING);
  21.         } catch (IOException e) {
  22.             e.printStackTrace();
  23.         }
  24.  
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement