开发者

Java retrieving file with /*/ in the path

开发者 https://www.devze.com 2023-03-26 16:58 出处:网络
i am aware i am asking somethink that cannot be done without manually looping over the file system. But maybe someone have a be开发者_Python百科tter idea then mine.

i am aware i am asking somethink that cannot be done without manually looping over the file system. But maybe someone have a be开发者_Python百科tter 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


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.


String absolutePath = temp.getAbsolutePath(); System.out.println("File path : " + absolutePath);

        String filePath = absolutePath.
                 substring(0,absolutePath.lastIndexOf(File.separator));

        System.out.println("File path : " + filePath);
0

精彩评论

暂无评论...
验证码 换一张
取 消