app.project.item(index).parentFolder
Description
The FolderItem object for the folder that contains this item. If this item is at the top level of the project, this is the project’s root folder (app.project.rootFolder).You can use the ItemCollection’s addFolder method to add a new folder, and set this value to put items in the new folder. See ItemCollection addFolder() method”.
Type
FolderItem object; read/write.
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;
}