Found this to be tricky; Having the following code:
String cmd = "find /home/folder/ -type f";
Runtime run = Runtime.getRuntime() ;
Process pr = run.exec(cmd);
pr.waitFor();
I’ll pr.getInputStream() and have the proper find result there, no problem. However, if I want to be a bit more specific and have my command as cmd = "find /home/folder/ -type f -name somefile*";, the input stream will be empty.
Now, I thought it would be something related to the string expansions done by the interactive shell (which wouldn’t be used in this case, I suppose). In this case the * would have no meaning, and find would be looking for files really named “*” (something like \*). So I’ve tried to have my command as sh -c "find /home/folder/ -type f -name somefile*". But it didn’t work either…
What am I missing?
thanks,
f.
Ps.: It is an AIX box, with IBM’s Java JVM.
I always escape the wildcard when using
find: