From a5a8675405b1c5ed571c5e6d1103cbaf2b7c51eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20V=C3=A1ssquez=20P=C3=A9rez?= Date: Wed, 2 Nov 2016 13:21:59 -0700 Subject: [PATCH] Created a AFX script to reroute all files in a project to a specific path. --- jsx/ReplaceAllFiles.jsx | 1 + 1 file changed, 1 insertion(+) create mode 100644 jsx/ReplaceAllFiles.jsx diff --git a/jsx/ReplaceAllFiles.jsx b/jsx/ReplaceAllFiles.jsx new file mode 100644 index 0000000..49e8fe0 --- /dev/null +++ b/jsx/ReplaceAllFiles.jsx @@ -0,0 +1 @@ +app.beginUndoGroup("ReplaceAllFiles"); var project = app.project; var new_path =prompt("Enter new path for footage:","/","New Path"); function getFootageItems() { footageItems =[]; for ( var i = 1 ; i < project.items.length ; i ++ ) { footageItem = project.items[i]; if ( footageItem.typeName == "Footage" && footageItem.file != null ) { footageItems.push(footageItem); } } return footageItems; } function getLastFolder( file_path ) { tree = file_path.split("/"); lastFolder = tree[tree.length-1]; return lastFolder } function replaceFiles( footageItems, path ) { seq_ptn = new RegExp("\[[0-9\-].*\]","g"); for ( var i = 0 ; i < footageItems.length ; i ++ ) { var footageItem = footageItems[i]; if ( footageItem.mainSource.isStill == true || footageItem.name.match ( seq_ptn ) == null ){ footageItem.replace( File( new_path + footageItem.name ) ); } else { footageItem.replaceWithSequence( File( new_path + getLastFolder( footageItem.file.path ) +"/"+ footageItem.file.name ), false ); //alert( new_path + footageItem.file.name ); //alert( new_path + getLastFolder( footageItem.file.path ) +"/"+ footageItem.file.name ); } writeLn("Replacing :" +footageItem.file.name ); } writeLn("Booyakasha!"); } clearOutput(); replaceFiles( getFootageItems() , new_path ); app.endUndoGroup(); \ No newline at end of file