Importing Files and Folders into Premiere

You can’t do much in Premiere without footage that has been imported. So why not speed up that process too?

In this video I share with you the various way’s I have learned to import files and folders into Premiere with Extendscript. There are a few different options I share with you on how to do this. We can:
– Import a Single File
– Import Multiple Files of all types
– Import files directly into a bin within Premiere
– Import a folder with all of it’s subfolders
– Import a folder without all of its subfolders

Throughout these examples, the base knowledge is included to customize your import process to whatever your needs are. If you need to know how to import only .mp3 and .wav files from only a folders subfolders, while placing those various types of media in different Premiere bins, this video will provide you with that knowledge.

It’s easy enough for just one file
var importSingleFile = File.openDialog ("Import Video File");
var importAry = [];
importAry.push(importSingleFile.fsName);
app.project.importFiles(importAry);

For multiple files, it is only slightly more difficult
The big question here is whether or not you need to distribute your tool across a variety of operating systems. If so, this bit of code will be necessary to deal with your import dialog.
var filterString = "";
if (Folder.fs === 'Windows'){
filterString = "All files:*.*";
}

With the information of how to format the filepath “slashes” stored in filterString we can now complete the rest of the process.
var importManyFiles = File.openDialog ("Import Files", filterString,true);
var importAry = [];


if (importManyFiles){
for (var i = 0; i < importManyFiles.length; i++) {
importAry[i] = importManyFiles[i].fsName;}}

app.project.importFiles(importAry,1,app.project.rootItem,0);

To limit the types of files we can import through the import dialog, we have to change the filterString
On a Windows computer, if I only wanted to allow the user to import a .mov file, I would limit it by calling the import dialog like this:
var importManyFiles = File.openDialog ("Import Files", "All Files: *.mov*",true);
Where the first argument is the title of the window, the second is the filterString for all files that are “.mov”, and the third argument allows multiple files to be selected.
We can also filter our file types when pushing them from the importManyFiles array, into our official importArray.

To import items directly into a bin in Premiere
We target that bin and get its location index, then include that as the third argument in the .importFiles() function, rather than app.project.rootItem.
app.project.importFiles(importAry,1,app.project.rootItem.children[0],0);

The reason I always work with a separate importAry array, is because I like the filtering capabilities it gives me
In the final example in this movie, while looping through my filepaths from the importFiles array, I can test for types of files I dont want before pushing them into importAry. For example, a subfolder will not have a period before the extension, because there is none. Therefore, I can ask the conditional
if(importFiles[i].toString().indexOf(".") > -1){
to see if the file is a subfolder, and exclude it from the importAry.