addFolder()

app.project.items.addFolder(name)

Description

Creates a new folder. Creates and returns a new FolderItem object and adds it to this collection.

If the ItemCollection belongs to the project or the root folder, then the new folder’s parentFolder is the root folder. If the ItemCollection belongs to any other folder, the new folder’s parentFolder is that FolderItem.

To put items in the folder, set the item object’s parentFolder attribute; see Item parentFolder attribute.

Parameters

name A string containing the name of the folder.

Returns

FolderItem object.

Example

This script creates a new FolderItem in the Project panel and moves compositions into it.
// create a new FolderItem in project, with name "comps"
var compFolder = app.project.items.addFolder("comps");
// move all compositions into new folder by setting
// compItem’s parentFolder to "comps" folder
for(var i = 1; i <= app.project.numItems; i++) { if(app.project.item(i) instanceof CompItem) app.project.item(i).parentFolder = compFolder; }

Other Tags

Posted in ItemCollection object and tagged , , , , , , , , , , , , .