是否可以从 Java 中发现插入的磁盘?

发布于 2024-07-25 00:40:05 字数 75 浏览 10 评论 0原文

我正在编写一个磁盘爬虫,如果用户没有提供现有路径,则程序应该搜索所有可用的磁盘。 有谁知道这是否可能,如果是如何从Java做到这一点?

I'm writing a disk crawler and if the user doesn't provide an existing path the program should search all disks that are available. Does anybody know is it possible and if it is how to do that from Java?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

百善笑为先 2024-08-01 00:40:05

尝试这个:

File.listRoots();

Try this:

File.listRoots();
黎歌 2024-08-01 00:40:05

仅适用于 Windows,在基于 UNIX 的操作系统上,您将拥有 1 个 root,与磁盘数量无关。

Only works on windows, on unix based operating system you will have 1 root, independent of the number of disks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文