• Post Reply Bookmark Topic Watch Topic
  • New Topic

Check Directory Permissions

 
Mike Cochrane
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to figure out how you would check to see if a user has access to a directory or file object. I know you can do:

File f = new File("C:\\path");
f.canRead();

but this checks if the application can read a directory. Is there a way if I had a user's NT username and password to check the access permissions using those credentials?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35716
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike,
Welcome to JavaRanch!

If you know how to do this from DOS, you could make a Runtime.exec() call to the operating system. There isn't a way to do it in pure Java.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!