0

Hide a Folder through java application(so that from windows settings also one couldn't able to read the folder)

I have Tried this However i want that from windows explorer also one shouldn't able to watch it.

public static void main(String[] args) throws SecurityException {
        Path path = FileSystems.getDefault().getPath("\\rd2");
try {

    Files.setAttribute(path, "dos:hidden", true);
} catch (UnsupportedOperationException x) {
    System.err.println("DOS file" +
        " attributes not supported:" + x);
}

I Have tried this one but not got the result.. can Anyone help me in this problem..

String path="\\r1";
    File file = new File(path);

    if (!file.exists()) {
    if (file.mkdir()) {

                           file.setReadable(false);
                            file.setExecutable(false);
                            file.setWritable(false);
                            System.out.println("Directory is created!");

    } else {
        System.out.println("Failed to create directory!");
    }
}

can Anyone help me in this problem..

StoopidDonut
  • 8,407
  • 2
  • 30
  • 48
  • check this out: http://stackoverflow.com/questions/1294989/make-a-file-folder-hidden-on-windows-with-java – b4da Jan 31 '14 at 22:01
  • i didn't get any helpful info from that link.. That given code can hide a folder however From Windows Explorer(View Settings) One Can Unhide that.. – Vande Mataram Feb 14 '14 at 08:45

0 Answers0