how do you restrict directory path to role? How would you go about restricting a specific directory path to a role? 

www.example.com/example1/example3/example4 

How do you restrict role access to the directory example1 so that example3 and 4 are restricted automatically?

Thanks!
This depends on what that path is? Drupal has many kinds of paths and default permissions out of the box. If this was a Book hierarchy default permissions exist for books. The same for Taxonomy terms and other types of content. If this was a Views based path, you could configure Access rules in your view.

Without any 3rd party module support I would look at hook_menu if you are defining these paths yourself or hook_menu_alter if they are provided by another module.

Drupal Roles are not a reliable way to deem access to content -- I would alter the access callback for this path to use user_access permission values and create a custom permission such as view my custom site area and give that permission to  desired roles. Then I would an access arguments of view my custom site area so the user_access check works on those paths.

The Workbench Access module can do what you're asking if you define the Access rules using the Menu Scheme and not Taxonomies, but this module only works for Nodes last I checked.


  Workbench Access provide the hierarchical permissions across
  "Sections" of your web site. You can use menus, taxonomy, or create
  your own hierarchical structure for controlling access to a piece of
  content.