All Downloads are FREE. Search and download functionalities are using the official Maven repository.

utsupport.Rename Maven / Gradle / Ivy

There is a newer version: 1.6.9
Show newest version
package utsupport;

import java.io.File;

public class Rename
{
	public static void main(String[] argv)
	{
		File root = new File("E:\\svn\\EDWEN_TRUNK_11_09_2009\\UnitTest\\src\\test");

		processDir(root);
	}

	private static void processDir(File root)
	{
		String name = root.getName();

		if (name.equals(".svn"))
		{
			return;
		}

		File[] files = root.listFiles();

		if (files != null)
		{
			for (int i = 0; i < files.length; i++)
			{
				if (files[i].isDirectory())
				{
					processDir(files[i]);
				}
				else
				{
					processFile(files[i]);
				}
			}
		}
	}

	private static void processFile(File file)
	{
		String name = file.getName();

		if (name.endsWith(".infatest"))
		{
			File newFile = new File(file.getParentFile(), name.substring(0, name.length() - 8) + "infaunit");

			System.out.println(newFile.getAbsolutePath());

			file.renameTo(newFile);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy