Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Check Directory Permissions  RSS feed

 
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
Sheriff
Posts: 36406
454
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!