This page contains some sample programs which helped me during my career

This application will help you find all the files in a folder and if will change all the filenames etc.

public class RenameFiles 
 public static void main(String[] args) 
  String path = "C:/Users/abcs/"; 
  String oldFilename;
  File folder = new File(path);
  File[] listOfFiles = folder.listFiles(); 
  File oldfile = null;
	File newfile = null;
  for (int i = 0; i < listOfFiles.length; i++) 
   if (listOfFiles[i].isFile()) 
   oldFilename = listOfFiles[i].getName();
   oldfile =new File(path+"/"+oldFilename);
   newfile =new File(path+"/newfilename"+i+".jar");

		System.out.println("Rename succesful");
		System.out.println("Rename failed");


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s