Question: I am writing to know how can I do several actions on a Data Extension and Create Folder using Javascript by SSJS

Currently I can not create a folder.
I do not understand what is the problem .
By the way the only tool in Marketing Cloud that tells me if the script is successful is the "Automation" that I created specifically which tells me if the script is "Completed" or gives "Error".

Definitely something wrong in the JavaScript code. However I ask you to assist me at least to create a sub-folder under the folder "Data Extensions". Can you tell me if this code is correct or not? 

```
<script runat=server>

Platform.Load("core","1");

var myDE = Folder.Retrieve({Property:"Name",SimpleOperator:"equals",Value:"Data Extensions"});
myDE.SetID(12345);

var newFolder = {
    "Name" : "Folder Script",
    "CustomerKey" : "test_folder_key",
    "Description" : "Test added",
    "ContentType" : "dataextension",
    "IsActive" : "true",
    "IsEditable" : "true",
    "AllowChildren" : "false",
    "ParentFolderID" : 12345
};

var status = myDE.Add(newFolder);

</script>

```

Regards
Riccardo Pruner

Answer: 
you require `Parent Folder ID` to create the folder path and same need to pass in `ParentFolderID` DataFolder object properties.

You can hard code your DataExtension Folder ID OR you can get dynamically by using `SSJS` link below:

```
<script runat=server>

Platform.Load("core","1");

var myDE = Folder.Retrieve({Property:"ContentType",SimpleOperator:"equals",Value:"dataextension"});
var myDEParentFolderID = myDE[0].ID;

var newFolder = {
    "Name" : "Folder Script",
    "CustomerKey" : "Folder Script",
    "Description" : "Test added",
    "ContentType" : "dataextension",
    "IsActive" : "true",
    "IsEditable" : "true",
    "AllowChildren" : "false",
    "ParentFolderID" : myDEParentFolderID
};

var status = Folder.Add(newFolder);
Write(status);

</script>

```

**Result:**
OK
thanks for the advice. 
I'd like to create this folder path. I attach a img to show a sample path that I would want to create. Then I try to write a sample code where I create a Father Folder e the first Child Folder. 
Unfortunatly this code doen't work. Any suggestionss ? 

[![enter image description here](https://i.stack.imgur.com/DmqlM.png)](https://i.stack.imgur.com/DmqlM.png)

```
<script runat=server>

Platform.Load("core","1");

var DE = Folder.Retrieve({Property:"Name",SimpleOperator:"equals",Value:"My Emails"});
var DEParentFolderID = DE[0].ID;

var folderONE = {
    "Name" : "2016",
    "CustomerKey" : "folder_script",
    "Description" : "forlderPath",
    "ContentType" : "email",
    "IsActive" : "true",
    "IsEditable" : "true",
    "AllowChildren" : "false",
    "ParentFolderID" : DEParentFolderID
};

var status = Folder.Add(folderONE);
Write(status);

var myDE = Folder.Retrieve({Property:"Name",SimpleOperator:"equals",Value:"2016"});
var myDEParentFolderID = myDE[0].ID;

var folderTWO = {
    "Name" : "Commerciali",
    "CustomerKey" : "folder_script1",
    "Description" : "forlderPath",
    "ContentType" : "email",
    "IsActive" : "true",
    "IsEditable" : "true",
    "AllowChildren" : "false",
    "ParentFolderID" : myDEParentFolderID
};

var status = Folder.Add(folderTWO);
Write(status);

</script>

```