package javaapplication1;
import java.io.*;
public class JavaApplication1
{
public static void main(String[] args)
{
try
{
File file = new File("d:\\data.bin");
if (! file.exists())
throw new java.io.IOException("file d:\\data.bin - not exists");
if (file.renameTo(new File("d:\\test\\" + file.getName())))
System.out.println("move success");
else
System.out.println("move failed");
}
catch (Exception e)
{
System.out.println("Error rename file: " + e.getMessage());
}
}
}
/*
run:
move success
*/