Rename a file
import java.io.File;
import java.io.IOException;
public class Rename {
public static void main(String[] argv) throws IOException {
File f = new File("Rename.java");
f.renameTo(new File("junk.dat"));
}
}
Home
Java Book
Runnable examples
Java Book
Runnable examples
IO File:
- Compare File Dates
- Compress files using with ZIP
- Concatenate files
- Copy a File with NIO FileChannel and ByteBuffer
- Copy a file with FileReader and FileWriter
- Copy a file with InputStream and OutputStream
- Copy a file and overwrite
- Delete a file
- Delete File Recursively
- Get readable file size
- Move a file
- Rename a file
- Report a file's status
- Search a file by regular expressions
- Touch a file: set File Last Modified Time