JAVA – Hot To Rename a File or Directory.

A quick script to re-name a file or folder:

Import required:



        // File name (or directory) of the file to be renamed
        File file = new File(“c:/file1.txt”);
        // New File name (or directory)
        File file2 = new File(“c:/file2.txt”);
        // Rename file (or directory)
    }catch(Exception e){

How To Stop Web Users Having Access To / Seeing The Contents Of Web Folders

Here is a very simple, but effective way to stop web users being able to see the contents of a folder on a web host.

put index.htm file in the folder.

When the web user navigates to the folder, the index.htm file will display,  rather than the contents of the folder.
The htm file can be empty, in which case the browser ill display a blank page.

Simple.. but effective!