title: How to get sub directory in android?
body: <p>My code is for renaming files in a folder on the SD card, however, it doesn't rename files in sub folders present in the same folder.</p>
  
  <p>here is my approach, i added this line - </p>
  
  <pre><code>ExplorerDBOperation(listFile[i]);
  </code></pre>
  
  <p>but the error i get is - "The method ExplorerDBOperation(File) is undefined for the type Hide.ExplorerDBOperation" how do i call my method again? this is in an AsyncTask</p>
  
  <pre><code>@Override
      protected Boolean doInBackground(Void... params) {
          File listFile[] = myDirectory.listFiles();
          if (listFile != null) {
              for (int i = 0; i &lt; listFile.length; i++) {
                  if (listFile[i].isDirectory()) {
                      ExplorerDBOperation(listFile[i]);
                  } else {
                      String fPath = listFile[i].getPath();
  
                      for (String ext : TARGET_EXTENSIONS) {
                          fPath = fPath.replace("." + ext,
                                  "a6d5dx" + ext);
                      }
  
                      listFile[i].renameTo(new File(fPath));
                  }
              }
          }
          return true;
      }
  </code></pre>
  
  <p><strong>FULL CODE</strong></p>
  
  <pre><code>// getting SDcard root path
  File myDirectory = new File(Environment.getExternalStorageDirectory()
          + "/SecuDrive/");
  public static final String[] TARGET_EXTENSIONS = {  "exe", "apk", "tar", "img", "iso" };
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_hide);
      // at the end of oncreate
      new Handler().postDelayed(new Runnable() {
          @Override
          public void run() {
              new ExplorerDBOperation().execute();
          }
      }, 300);
  }
  
  class ExplorerDBOperation extends AsyncTask&lt;Void, Boolean, Boolean&gt; {
      ProgressDialog dialog;
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          dialog = ProgressDialog.show(Hide.this, "Please wait",
                  "Processing..");
      }
  
      @Override
      protected Boolean doInBackground(Void... params) {
          File listFile[] = myDirectory.listFiles();
          if (listFile != null) {
              for (int i = 0; i &lt; listFile.length; i++) {
                  if (listFile[i].isDirectory()) {
                      ExplorerDBOperation(listFile[i]);
                  } else {
                      String fPath = listFile[i].getPath();
  
                      for (String ext : TARGET_EXTENSIONS) {
                          fPath = fPath.replace("." + ext,
                                  "a6d5dx" + ext);
                      }
  
                      listFile[i].renameTo(new File(fPath));
                  }
              }
          }
          return true;
      }
  </code></pre>