java - How to check if I can delete a file? -


how can check can delete file in java?

for example, should able delete file c:/file.txt never able delete c:/ or computer, or my documents etc.

solution described in possible duplicate not work me.

removing file requires write permission of file's parent, i.e. directory file stored. directory in java represented instance of class java.io.file has method canwrite().

so, check whether file can deleted should call file.getparent().canwrite().


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -