Folder Setup Script is a free Adobe After Effects Script to automatically create a hierarchy of Folders inside the Project Panel.

You must be well aware that After Effects is capable of running scripts. These scripts are lines of code that give additional functionality and features to After Effects.

After Effects Scripts use a language called ExtendScript which is a modified version of JavaScript. Therefore you need a deep knowledge of JavaScript to create Adobe After Effects scripts.

However, there are tons of free scripts on the web, and using them is extremely easy. One such free After Effects script is the Folder Setup Script. It helps you organize your After Effects projects by automatically creating folders in the Project panel.


After Effects Folder Setup Script

Folder Setup Script After Effects

This script allows you to describe a hierarchy of folders to create in the Project panel by entering folder names on successive lines, with the indentation implying the nesting level.

To enter new lines, press Ctrl+Enter (Windows) or Ctrl+Return (Mac) in CS5.5 and earlier, or just Enter/Return in CS6 and later.

Use four (4) additional spaces of indentation at the beginning of a line to indicate that you want a folder to be created inside the previous parent folder.

You can use this script as a dockable panel by placing it in a ScriptUI Panels subfolder of the Scripts folder and then choosing the Folder Setup.jsx script from the Window menu.

Downloading Folder Setup Script

Downloading this free After Effects script is pretty straightforward. Click on the download button below or right-click on it and then click on the SAVE LINK AS to start the download.

Once downloaded, use any extracting tool to unzip the file.


How To Run The Script

To run the Folder Setup Scrip, Go to File > Script > Run Script, browse to the directory where you downloaded the script, and open it.

folder setup free after effects script

A pop-up panel will appear where you can set the folder names depending on your source files. Then simply click on the CREATE FOLDERS button and the script will successfully do its job of creating the folders.


Using Source Code To Run The Script

An alternate way to run the script is to copy the source code below and paste it into the After Effects script editor. In After Effects, go to File > Scripts > Open Script Editor and paste the following source code.

{

function FolderSetup(thisObj)
{
var folderSetupData = new Object();
folderSetupData.scriptName = "Folder Setup";
folderSetupData.version = "1.2";

folderSetupData.strAboutTitle = "About " + folderSetupData.scriptName;
folderSetupData.strAbout = folderSetupData.scriptName + " " + folderSetupData.version + "\n" +

"This script allows you to describe a hierarchy of folders to create in the Project panel by entering folder names on successive lines, with the indentation implying the nesting level.\n" +
"\n" +
"To enter new lines, press Ctrl+Enter (Windows) or Ctrl+Return (Mac) in CS5.5 and earlier, or just Enter/Return in CS6 and later. Use four (4) additional spaces of indentation at the beginning of a line to indicate that you want a folder to be created inside the previous parent folder.\n" +
"\n" +
"You can use this script as a dockable panel by placing it in a ScriptUI Panels subfolder of the Scripts folder, and then choosing the Folder Setup.jsx script from the Window menu.";
folderSetupData.strFolderHierarchy = "Folder Hierarchy:";
folderSetupData.strDefaultHierarchy = "Folder 1\n Subfolder A\n Sub-subfolder I\n Sub-subfolder II\n Subfolder B\nFolder 2\n Subfolder C\n Subfolder D\nFolder 3";
folderSetupData.strCreateFolders = "Create Folders";
folderSetupData.strHelp = "?";
folderSetupData.strErrMinAE90 = "This script requires Adobe After Effects CS4 or later.";

// folderSetup_buildUI()
// Function for creating the user interface
function folderSetup_buildUI(thisObj)
{
var pal = (thisObj instanceof Panel) ? thisObj : new Window("palette", folderSetupData.scriptName, undefined, {resizeable: true});

if (pal != null)
{
var hierarchyWantReturn = (parseFloat(app.version) >= 11) ? ", wantReturn: true" : "";
var res =
"""group {
orientation:'column', alignment:['fill','fill'],
header: Group {
alignment:['fill','top'],
hierarchyTitle: StaticText { text:'""" + folderSetupData.strFolderHierarchy + """', alignment:['fill','bottom'] },
helpBtn: Button { text:'""" + folderSetupData.strHelp + """', alignment:['right','top'], preferredSize:[25,-1] },
},
hierarchy: EditText { properties:{multiline: true""" + hierarchyWantReturn + """}, alignment:['fill','fill'], preferredSize:[150,150] },
createBtn: Button { text:'""" + folderSetupData.strCreateFolders + """', alignment:['center','bottom'] },
}""";
pal.margins = [10,10,10,10];
pal.grp = pal.add(res);

pal.grp.header.helpBtn.onClick = function () {alert(folderSetupData.strAbout, folderSetupData.strAboutTitle);}
pal.grp.hierarchy.text = folderSetupData.strDefaultHierarchy;
pal.grp.createBtn.onClick = folderSetup_doCreateFolders;

pal.layout.layout(true);
pal.layout.resize();
pal.onResizing = pal.onResize = function () {this.layout.resize();}
}

return pal;
}

// folderSetup_doCreateFolders()
// Callback function for creating the actual folder structure
function folderSetup_doCreateFolders()
{
var folderNames = this.parent.hierarchy.text.split("\n"); // Split the lines of edittext content into an array

if (folderNames.length > 0)
{
app.beginUndoGroup(folderSetupData.scriptName);

var matches;
var currParent = lastFolder = app.project.rootFolder, newFolder;
var currIndent = 0, newIndent;

// Traverse the folder names
for (var f in folderNames)
{
// Use a regular expression to pick off the indentation and folder name
matches = folderNames[f].match(/^(\s*)(.*)$/);
if ((matches != null) && ((matches.length == 3) && (matches[2] != ""))) // Skip blank lines
{
//$.writeln("creating folder named '"+matches[2]+"'");
newIndent = parseInt(matches[1].length / 4);

// Determine where to place the new folder
if (newIndent > currIndent) // Nest new folder
{
currParent = lastFolder;
currIndent++;
}
else if (newIndent < currIndent) // Create in some parent folder
{
// Find indent matching newIndent by traversing parent folders
while ((currIndent > 0) && (currIndent > newIndent))
{
currParent = currParent.parentFolder;
currIndent--;
}
}
// else create at same level as previous folder (sibling)

// Create the new folder in the current parent
lastFolder = newFolder = app.project.items.addFolder(matches[2]);
newFolder.parentFolder = currParent;
}
}

app.endUndoGroup();
}
}

// main:
//

if (parseFloat(app.version) < 9)
{
alert(folderSetupData.strErrMinAE90, folderSetupData.scriptName);
return;
}
else
{
var fsPal = folderSetup_buildUI(thisObj);
if (fsPal != null)
{
// Use the last defined folder hierarchy (saved in the After Effects preferences file), if it exists
if (app.settings.haveSetting("Adobe", "folderSetup_hierarchy"))
{
fsPal.grp.hierarchy.text = app.settings.getSetting("Adobe", "folderSetup_hierarchy").toString();
}

// Save current folder hierarchy upon closing the palette
fsPal.onClose = function()
{
app.settings.saveSetting("Adobe", "folderSetup_hierarchy", fsPal.grp.hierarchy.text);
}

if (fsPal instanceof Window)
{
fsPal.center();
fsPal.show();
}
else
fsPal.layout.layout(true);
}
}
}

FolderSetup(this);
}

Then go to Debug > Run or simply press F5 on your keyboard to run it.


Also, check out: