Next Tutorial
Drupal 7 Tutorial Part 19: Understanding Drupal 7 Content Types & Fields Concepts !
Drupal 7 Tutorial Part 14: Drupal 7 File System & structure explained
Hello Drupalers,
In this tutorial we are going a bit deep into Drupal package and understanding the file structure of the drupal and its core components. This tutorial is very important if you are trying to figure out how to write drupal modules for customizations. This tutorial will help you understand the Drupal 7 File System and its's structure.
Let's get into the action. Go to http://drupal.org/project/drupal and download latest Drupal 7 package and unzip it. A folder will be seen once you uncompress the package. If you open the folder you will see more or like below file structure as shown in image.

- As you see in above image the drupla 7 package file system with folders and files. Let's discuss the each individual folders & files significance.
Drupal 7 Root Folders:
Includes:
- Includes folders contain several files which has common functionalities shared by Drupal Core Modules. For example it contains file called form.inc which can be used in user module or node module to build forms like user login form or create content form respectively. Includes also contains Database plugins like mysql, pgsql and other.
Misc:
- Misc folder contains javascript , images, which are again commonly used features across core modules in drupal. For example tabledrag.js file facilitates using drag & drop functionality for menus and block settings page.
Modules:
- All drupal core modules are placed in this directory. Each folder inside modules folder is called a module and gives specific functionality. For example user module is responsible for all user related features that you see when you install drupal. Features like user login form, register form, user sessions are working from this module. Some other modules are node, block, menu etc.
Profiles:
- Profiles are used during installation. When you are installing drupal you see screen like below to select standard or minimal installation settings. Profiles are used to choose only specific modules while installing drupal. These will be used for Drupal Distributions when users can select specific features while installing drupal according to their requirements.

- Profiles can be compared to Custom Or Default installation instructions screen of any softwares that will be displayed during installation like the one below.

- Profiles folder contains code for different profile settings that you see during installation screen.
Scripts:
- Scripts folder contains shell scripts that will be used for drupal functionality. One example will be cron.sh which will be used to configure drupal cron.
Sites:
- All drupal customizations goes into this folder. Like downloaded modules, custom modules, downloaded themes, custom themes are placed inside this directory. More in depth will be discussed later in my module development series tutorials in future.
- It also contains drupal settings.php file inside defaults directory which is bascially used to specify database connection settings.
Themes:
- Drupal default themes that comes with drupal package are placed inside this directory.
Stay tuned with this tutorial to know more about files inside drupal root folder.
Cheers,
Anil Sagar

2 comments
Drupal Begineer
I am new guy for Drupal. I get it clear file structure for Drupal 7. It's very helpful to me.
Wonderful site about drupal
Wonderful site about drupal 7! The author provided rich of information and step by step guide about the drupal 7. This post should be shared to your friend to gain more wisdom about drupal. The author's note are clear and concise. Very easy to understand and direct to the point. Nice post and more power.
Post new comment