title: How to use "ls *.c" command in java?
body: <p>I am trying to print "*.C" files in java</p>
  
  <p>I use the below code</p>
  
  <pre><code>public static void getFileList(){
      try
      {
          String lscmd = "ls *.c";
          Process p=Runtime.getRuntime().exec(lscmd);
          p.waitFor();
          BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
          String line=reader.readLine();
          while(line!=null)
          {
              System.out.println(line);
              line=reader.readLine();
          }
      }
      catch(IOException e1) {
          System.out.println("Pblm found1.");
      }
      catch(InterruptedException e2) {
          System.out.println("Pblm found2.");
      }
  
      System.out.println("finished.");
  }
  </code></pre>
  
  <p>P.S:- It is working fine for "ls" command.when I am using "*" in any command, all aren't work. need the replacement of "*" in the command in java.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks for your help guys.</p>
  
  <p>Now i need the same result for the comment " ls -d1 $PWD/** "in java. it will list all the directory names with the full path.</p>
  
  <p>Thanks for your time.</p>