Advertisement
sedran

Java Simple Renamer

Aug 25th, 2011
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. import java.io.File;
  2.  
  3. public class Renamer {
  4.     static String directory = "E:\\Müzikler\\Duman";
  5.     public static void main(String[] args) {
  6.         File dir = new File(directory);
  7.         if(dir.exists() && dir.isDirectory()) {
  8.             File[] files = dir.listFiles();
  9.             for(int i=0; i<files.length; i++) {
  10.                 if(files[i].isFile()) {
  11.                     System.out.println("From : " + files[i].toString());
  12.                     String newPath = files[i].getParent() + File.separator + "Duman - " + files[i].getName();
  13.                     System.out.println("To   : " + newPath);
  14.                     files[i].renameTo(new File(newPath));
  15.                 }
  16.             }
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement