# Create a folder in a root file

**URL:** <https://root-forum.cern.ch/t/create-a-folder-in-a-root-file/54384>\
**Category:** Newbie\
**Tags:** root\
**Created:** [April 6, 2023, 7:24am UTC](https://root-forum.cern.ch/t/create-a-folder-in-a-root-file/54384 "2023-04-06T07:24:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emil\_R](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/emil_r/32/31255_2.png) [@Emil\_R](https://root-forum.cern.ch/u/Emil_R)\
**Post date:** [April 6, 2023, 7:24am UTC](https://root-forum.cern.ch/t/create-a-folder-in-a-root-file/54384/1 "2023-04-06T07:24:52Z")

</div>

Hi everyone,  
I want to create a folder inside of a root file, so that when I browse the file, I see several folders, which contain files.  
This probably has an extremely simple solution, but I can’t seem to find the right command.  
Thanks,  
Emil

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [April 6, 2023, 7:31am UTC](https://root-forum.cern.ch/t/create-a-folder-in-a-root-file/54384/2 "2023-04-06T07:31:21Z")

</div>

```auto
root [0] auto f = new TFile("bla.root","Recreate");
root [1] f->ls()
TFile** bla.root	
 TFile* bla.root	
root [2] f->mkdir("foo")
(TDirectory *) 0x7f8925f5ad20
root [3] f->ls()
TFile** bla.root	
 TFile* bla.root	
  TDirectoryFile* foo	foo
  KEY: TDirectoryFile	foo;1	foo
root [4] 

```
