在Java 6中使用通配符解析绝对路径 [英] Resolve absolute paths with wildcards in Java 6

查看:72
本文介绍了在Java 6中使用通配符解析绝对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我必须以编程方式使用Java查找许多目录.这些目录都具有相同的模式:

My problem is that I have a number of directories I have to look into programmatically, in Java. These directories all have the same pattern:

d:\a\b\c\??_????\d\

我找不到明智的方法.任何FileFilter(我使用WildcardFileFilter)都需要一个基本目录进行查找,因为它们仅与listFiles()一起使用,但是在我的情况下,由于我的路径是绝对的,所以没有基本目录.我从Web尝试了一些技巧失败,然后陷入困境.非常感谢您的帮助.在此处输入链接说明

I cannot find a way to do this smartly. Any FileFilter (I use WildcardFileFilter) will need a base directory to look into, as they only works with listFiles(), yet in my case there is not base directory as my paths are absolute. I've unsuccessfully tried a few tricks from the Web and then I'm stuck. Your help will be greatly appreciated.enter link description here

推荐答案

尝试使用指向根文件夹或d:\ a \ b \ c的listFilesAndDirs.

Try use listFilesAndDirs pointing to root folder or to d:\a\b\c.

这篇关于在Java 6中使用通配符解析绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆