Free Function Friday aeToOSFolder

FFF Header

Welcome to this week’s Free Function Friday episode. Today we build a handy function that will replicate* your After Effects project folder structure locally on your computer. This function was something I had dabbled with a few times in the past, but never got it fully working to include nested folders. The subject came up on the Adobe After Effects Scripting forums not too long ago and so I brought out my old code and started trying to figure out the remaining pieces to the puzzle. You can view that forum conversation here. After a few tries, it clicked and I found a solution to make it work using another recursive script I had built previously.

This aeToOSFolder function is a little different than some of the other functions in this series in that it actually uses a function within itself. So we are packaging our main function, aeToOSFolder, to make this folder replication process self contained, and it requires a process that needs to be callable just as easily. This is the recursive part, so we make a mini function to perform that and just nest it within this function. In the bigger picture of building a full scale script that uses aeToOSFolder, you could actually pull the nested function out and place it at the same level as aeToOSFolder. This probably sounds a bit confusing, so I would’t worry too much about it right now. That’s something we may chat about down the line. For right now I’ve built the functions in this series to be self contained, so you may see similar code from time to time due to this. Once you have a better understanding, you’ll be tearing these apart and customizing your own builds. 🙂

If you haven’t done so already there is a Free Function Friday introduction video located here that has some important information pointing to a few resources that will come in handy when scripting for After Effects.

Episode 3 aeToOSFolder:

 

*The creation of OS folders is limited, so a 100% match is almost impossible in some scenarios. If you have more than one After Effects project folder with the same name inside the same parent folder, then this cannot be replicated on the OS side as it will try to save over the first folder name that already exists. It will also do so without warning you, which can be a very bad thing. So I built the code in a way that it will ignore the duplicate and just create one folder instead.

Legal note: The Adobe ExtendScript code talked about in this article and accompanying embedded video(s), and/or graphic images are not guaranteed to be compatible with every version of After Effects. David Torno, ProVideo Coalition, and Diversified will not be held liable for any misuse or incorrect use of the provided ExtendScript code. Use at your own risk.

All of the code I provide in this series, has been created and tested in After Effects CC 2014. Unless otherwise specified in the episode, the code should be compatible with After Effects CS6 through CC 2015. I’ve done my best to avoid depreciated code (code that Adobe removed at some point), and made these functions as compatible as possible. There will however be the occasional piece of code that is brand new as of a certain version of After Effects and therefore will not be backwards compatible from that version. I will mention these if that is the case.

With that said, all the code I provide in this series is open source and free to use in your scripts. I highly encourage you to expand and improve upon the code I provide and start making your own custom functions as well, but please do not repost the code I show in this series as is and claim it as your own. If you use any of the code provided in this series please give credit where credit is due. This series is meant to provide, what I feel is useful code, as well as to hopefully further explain ExtendScript and it’s quirks. While the functions we build throughout this series can perform a task all on their own, they are not meant to be a solo script. How you combine them together and expand upon them is when you will gain the most from these functions.


Share:

David Torno

David Torno is a Visual Effects professional based in Los Angeles, California. His work over the years has included commercials, feature films, music videos, and multimedia projects. During his free time, David enjoys expanding his knowledge in Visual Effects by learning new softwares and techniques that are being used. Along the way he also contributes to the visual effects community by offering helpful tools, and tutorials that creative professionals around the world can benefit from.

PVC Logo
PVC App Demo

Now Available in the App Store

Get access to our latest and featured articles from your favorite authors, wherever you are, directly on your phone!

  • Clean and Easy to Read
  • Blazing Fast Notifications for New Articles
  • Free Tuesday Webinar Access
Apple App Store
Google App Store
Get your FREE Search Bins Project File!
Want Us to Remind You?
Enter your email and subscribe!
Get Access!
Please enter your email address to view our free live webinar!
*you will be added to the ProVideoCoalition.com newsletter and if you’re already signed up, it won’t send you duplicate e-mails