0

Hi guys I am Using CreateNewFile() function to make a .txt file I them Hide it using the Following Code In System32 Directory.

Process p = Runtime.getRuntime().exec("attrib +h " + f.getPath());
p.waitFor();  

The File is getting Hidden successfully But I need it to be secure so that you cannot delete it even if you wanted to. Is there a way to achieve this Programmatically?

Stanley Mungai
  • 4,044
  • 30
  • 100
  • 168
  • btw, you can set file attributes using java 7 http://stackoverflow.com/questions/664432/how-do-i-programmatically-change-file-permissions – gigadot Sep 14 '12 at 10:09
  • @Wookie88, if you believe the answer to that, I'm going to need your username and password to paypal in order to approve that comment. – Neil Sep 14 '12 at 10:19

2 Answers2

2

I don't think so You can do it. Every file can be deleted somehow in windows(booting in safe mode).

amicngh
  • 7,831
  • 3
  • 35
  • 54
0

The only way is to use Username while creating File. You can not delete file created by other user unless you are administrative.

You will find More information Undeletable Folder in java

Community
  • 1
  • 1
Amit Deshpande
  • 19,001
  • 4
  • 46
  • 72