is one folder is the Sub Directory from another folder - Android java.io

Android examples for java.io:Folder

Description

is one folder is the Sub Directory from another folder

Demo Code

import java.io.File;
import java.util.regex.Pattern;

public class Main {

  public static boolean isSubDirectory(File sourceLocation, File targetLocation) {
    return Pattern.matches(sourceLocation.getAbsolutePath() + ".*", targetLocation.getAbsolutePath());
  }/*from w  w w .jav a2s.  c  o m*/

}

Related Tutorials