Java 检索路径中带有 /*/ 的文件
我知道我在问一些问题,如果不手动循环文件系统就无法完成。但也许有人有比我更好的主意。
我有一个用户列表,其中只有一个在他自己的文件夹中包含
来自linux shell的文件aaa.xml,当然如果我输入
vi /user/*/aaa.xml
我可以打开该文件。我想在java中使用相同的未来,但它似乎不可行。工作
File designFile = new File("/user/*/aaa.xml");
解决方案是尝试在每个用户目录中找到该文件,但它似乎不太好。你们有更好的主意吗?
干杯, 斯特
i am aware i am asking somethink that cannot be done without manually looping over the file system. But maybe someone have a better idea then mine.
i have a list of users and just one of them has in his own folder the file aaa.xml
from the linux shell of course if i type
vi /user/*/aaa.xml
i can open the file. I would like to use the same future in java but it seams not to Work
File designFile = new File("/user/*/aaa.xml");
solution would be to try to locate the file in each of the users directory but it seams not to nice. do you guys have a better idea??
cheers,
Ste
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可能与您正在寻找的内容有关。希望有帮助。
Java 所需的 FileSet 包/类
编辑:
那么这个怎么样?
如何查找与通配符字符串匹配的文件Java?
This might be related to what you are looking for. Hope it helps.
A FileSet package/class wanted for Java
Edit:
Then how about this?
How to find files that match a wildcard string in Java?
好吧..接缝不可行,因为不能在不同的操作系统上工作。
well.. seams not feasible because cannot work over different Operating systems.
字符串绝对路径 = temp.getAbsolutePath();
System.out.println("文件路径:" + AbsolutePath);
String absolutePath = temp.getAbsolutePath();
System.out.println("File path : " + absolutePath);