0

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

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
Stefano
  • 3,981
  • 8
  • 36
  • 66
  • possible duplicate of [A FileSet package/class wanted for Java](http://stackoverflow.com/questions/2891679/a-fileset-package-class-wanted-for-java) – Donal Fellows Aug 09 '11 at 08:37

3 Answers3

0

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);
Zeeshan Akhter
  • 1,881
  • 20
  • 19
0

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?

Community
  • 1
  • 1
mahju
  • 1,156
  • 1
  • 14
  • 21
  • i do not think it may work... for me rather than filtering i need somethink that automatically would loop all the folder for me. In linux this is done by the Operating system but perhaps is not supported by java because not all the OS support this feature! – Stefano Aug 09 '11 at 08:37
  • yes but just under linux. it does not work under windows... so perhaps for this reason java does not support it :( – Stefano Aug 31 '11 at 12:30
  • Under Windows the `java.exe` (or `javaw.exe`) executable actually does the same wildcard matching on its arguments that the shell usually does on POSIXy systems, so *if* you pass this as arguments, it will work on Windows as well. – Joachim Sauer Aug 31 '11 at 13:08
0

well.. seams not feasible because cannot work over different Operating systems.

Stefano
  • 3,981
  • 8
  • 36
  • 66