Batch Search-n-Replace Paths Demo Video This script has a dockable UI, click for an installation video tutorial

Batch process folders of After Effects project and search and replace file paths. This can come in handy if you are moving a project to a different folder structure like a new server. You can also use it to batch replace files in many projects at once.

"Name Your Own Price"
You can pay anything you want, the amount displayed in the cart is only a suggested amount.
View Cart

Batch Search-n-Replace Paths Compatible with After Effects CS3Compatible with After Effects CS4Compatible with After Effects CS5Compatible with After Effects CS5.5

Version: 1.6   Sign up to be notified by email when a new version of this script is posted

This script will batch process folders of After Effects projects and searches and replaces all the contained footage file paths. This can come in handy if you are moving a project (or many projects) to a different folder structure like a new server. You can also use it to batch replace files in many projects at once.

The script has 2 operating modes:

  1. An old school method which opens each project, checks all the footage items paths then replaces the path to the new path, imports the footage item from the new location and saves out a new project. This method works with CS3 & CS4.
  2. The faster and preferred method takes advantage of the new XML file format introduced in CS4. It opens each project, saves it out as an XML project (if original project is already in .aepx format then this step is skipped) and then does a search and replace on the XML file. This process is much faster since it doesn’t have to import all the footage items and it will preserve all the interpretation settings for every footage item.

USAGE:

  • It is recommended that you run the script in test mode first to see how After Effects sees the footage paths. Once you have that info you can accurately enter the search and replace strings. Note that on Mac XML projects path are separated by a colon : )
  • The project name match field allows you to enter a match string so the script will only work on projects whose name matches the string (you can use Regex if you turn on the option below).
  • If you use a project name match string you can enter a replace string for the new project name or just add a suffix or a prefix to be appended to the new project name.
  • Recurse subfolders will process and subfolders.
  • Use Regex will cause the script to use Regular Expressions syntax in the search string. If you don’t know what Regular Expressions are then it’s probably best that you don’t use this option.
  • Generate log will create a text file with all the results and errors encountered by the script.
  • If you are running in test mode you will be able to preview the search and replace results before actually doing it. The script will save a text file with the results of the search and replace operation.

Version History

  • 1.6 fixed project name match bug – 04/2011
  • 1.51 fixed path separator on mac CS5 – 06/2010
  • 1.5 – 05/2010
    • Added option to have more than 1 search replace pair
    • Added search replace option to project name
    • Blessed for CS5
    • Small bug fixes
  • 1.03 Fixed Log location help tip – 01/2010
  • 1.02 Fixed “Suppress dialogs” bug – 01/2010
  • 1.01 Fixed “undefined” error when write to network preference was not set – 11/2009
  • 1.0 Initial Release – 11/2009

Last updated April 12th, 2011
10,905 views
Tags: , , , , , , , , , , , , ,

Share      

About the author

I am a freelance art director and After Effects artist in New York City. I aim to provide high quality scripts that provide clever solutions for After Effects workflows.

Pingbacks

38 Comments

  • what you do is really a wonderful job?love your website

  • Can the script Search-n-Replace and also change the extension?
    I need to batch replace a bunch of AVI files with Quicktime equivalents

  • Oh, it seems like it does! Yey!

  • This is a great idea, but I get the “undefined” error when I try to run it.
    I’m using CS4 9.0.2.42 on windows XP
    Is there any way to get it running?

    • Fixed the “undefined” error. Please re-download and let me know how it works for you. It was a small error with the dialog box that warned that you need to have the “Allow Scripts to Access Network” preference set to run the script.

  • Hi! I used the script with the “Use XML project” option selected. The log stated that 12 files were successfully replaced. When I opened the updated .aepx file I was prompted with the following warnings:

    After Effects error: No element found
    ( 83 :: 2 )
    After Effects warning: Unknown BIB Error. No element found, AXEParser, 1003
    ( 83 :: 3 )
    After Effects warning: Unable to import file ‘something_updated.aepx’ as project.

    Any ideas as to what happened during the replace? There were no errors reported in the log file.

    An observation to note:
    No paths are replaced when I execute the script on the same project file with the same search string and WITHOUT the xml option selected.

    Thank you for any assistance with this issue.

  • this script (even the CS5) version does not work properly in Mac OS with CS5, at least with Snow Leopard. It seems that CS5 no longer saves path delimiters as “:” in aepx. It uses “/” now. I just commented out the part in your script that makes the auto-conversion from / to : and it works fine. Thanks for the script!

  • In CS3 (Mac os 10.5) I get the error “Unable to execute script at line 568. Illegal use of reserved word.”
    Any idea what this might be?

    • The CS3 version was accidentally excluded from the archive in the latest update but that has been corrected. The archive now includes 2 scripts. A CS3 version and a CS4 and above version. Of course the xml option is only available in CS4 and above and is the highly recommended option to use.

  • I really like the updated feature of allowing for multiple search/replace pairs.
    I wish I had this functionality months ago.
    …Would have saved hours(days!) of exporting each pair individually.

    Terrific!

  • Hello I’m AfterEffects 7.0. Can I this script?

  • Hi, I have a folder in after effects with 40 image files that I would like to replace with 40 different footage files on my harddrive, without having to replace them one by one.
    I tried the script, but nothing happened. Can this script achieve what I want? And how do I have to use it?

  • can i use ithe script to change only the drive name?

    • Yes, absolutely. That is one of the more popular uses of this script, when a project needs to be moved to a new server or drive or folder and all the paths need to be changed to point to the new location.

  • Hi.
    using script on CS5 on pc. Seems to work but found bug. I’m trying to conform paths from mac to pc. When asking script to replace /Volumes with \
    etwork it returns “\:
    etwork”. Inserting colon between slashes for some reason. Can you help? thanks!

    C

    • Are you running the script on a mac or pc? On Mac CS4 the script replaces slashes with colons due to a naming convention change Adobe made for that version only. I just tested it on CS5 on a PC and it converted /Volumes to \
      etwork without any colons.

  • Hey Lloyd,
    I’m running the script on a PC, running AE CS5, Windows 7.

  • Hello,

    I Import a aaf File from AVID (MAC) in After Effects (PC), but AAE don’t find the footage. Is it possible for this plugin to find the footage?
    AAE Path from the lost Footage said
    The Replace Footage and the original Footage have the same names, but have many different Folders and its in 99% tga-sequences!

    Thanks!

    • I don’t understand what you are explaining. If you cannot import it into AE this script will not help. What this script does is it updates paths. For example if you need to move media from one server to another and you need your after effects project to link to the new location.

  • I am having trouble replacing footage when the source folder no longer exists. I run the script, but the log shows an error stating “After Effects error: Unable to call

    • If the folder no longer exists you will only be able to do it using the XML option. Is that what you are trying?

      • Yeah, that’s what I’m trying. Unfortunately, I’m on CS3 so XML is not an option. The folder that has changed is the server, so we no longer have the old folder name available. Any other thoughts?

        • I am afraid you might be out of luck. CS3 was very limited in it’s flexibility. To replace paths the script has to do it through the “replace footage” command in AE which fails if the path is not valid. I would suggest upgrading. CS4 and above are much more capable especially for this high level kind of stuff. Also, much faster.

          • I was looking into the replace javascript command along with your script and I think there is something a little more subtle going on.

            I ran this code and the replace worked fine even with the source folder missing:
            var items = app.project.selection;
            var layer = items[0];
            replacePath = “/Users/user/Desktop/AFX_Projects/Art2/FullskiesBlueClouded0004_1_M.jpg”;
            replaceFile = new File(replacePath);
            layer.replace(replaceFile);

            However, looking at your code, the search/replace gets run on the item(m).file text. However, this property seems to give something like this:
            /Applications/Adobe%20After%20Effects%20CS3/Adobe%20After%20Effects%20CS3.app/Contents/MacOS/GFX-Work-i05:Users:user:Desktop:AFX_Projects:Art2:FullskiesBlueClouded0004_1_M.jpg

            I don’t know why the location of After Effects is found in the file variable, however it explains why the search and replace fails, because when anything is replaced, the location is still included, and that is no longer a proper path.

            Maybe stripping the executable location from the item(m).file variable before running the search/replace will help?

            • That is definitely a bug. The CS3 scripting api had many bugs that were fixed in CS4. So are you able to get it working with your workaround?

              • I believe I have gotten it to work. Although stripping the name wasn’t necessary. Using the item(m).file variable gave the wrong path, but using item(m).file.name gave the correct path. So this fix seems to work:

                Replace:
                var myProjItemPath = unescape(myProj.item(m).file);

                With:
                var myProjItemPath = unescape(myProj.item(m).file.name);

                At least on my computer with Mac OSX with CS3…

  • i am trying to replace footage that has another sequence count (i.e. sewuence frame 20-100, replacing with sequence frame 50-200).
    how can i do that?
    i was trying to do with an asterix in the search and replace string but i wont work. any ideas?

    • To do a wildcard search you’ll need to use Regex. If you tell me exactly what your wildcard search is I can write you a regex expression you can use.

  • This is a great little script. We’ve been using it to transfer files between PC and Mac and found it very helpful. We have however come across a couple of issues that we’ve struggled with.

    1. When dealing with PSD Layers the script seems to change the interpretation method so whereas before the using the script we had individual layers from the PSD after processing the file each individual layer now holds the entire PSD. This is particularly frustrating but I don’t know if we’re doing something wrong when we’re processing the files.

    2. the script doesn’t change the render Output path, this would be an incredibly useful option for us. At the moment we have to change this manually after converting the file.

    Still a very useful script though!

    Nick

  • Hi
    Great script but i’im trying to replace footage of psd files (sequence frames 0000-0500) with footage of psd files (sequence frames 0000-0300)
    How to do it?

    Greg

    • If there are the same name then you can just move frames 301-500 to a different folder. After Effects by default uses the entire sequence unless you used something like Immigration to bring in only a region of the sequence. You can’t do this by hand so most like you did not do this.

Leave a comment

(to reply to a specific comment use the "Reply to this comment" link next to the author's name)

For support related issues please contact support or post your issue in the forums