且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

检查网络是否具有写入文件夹的权限

更新时间:2022-11-25 10:29:51

尝试将小文件写入文件夹。如果它没有权限,它将失败。捕获异常。



至于获取这些权限,代码无法获得比用户已有的更多权限,因此在代码中实际上无法做到这一点。唯一的方法是,如果相关文件夹的管理员授予了这些权限。
Try writing a small file to the folder. If it doesn't have permissions, it'll fail. Catch the exception.

As for getting those permissions, code cannot get more permissions than the user already has, so there's really no way to do this in code. The only way to do that would be if an administrator of the folder in question granted those permissions.