No internet connection
  1. Home
  2. How to

How To Copy Files From Incoming Folder Into PT session folder.

By Lynn Graber @Lynn_Graber
    2023-10-20 14:38:10.521Z

    So, sessions that arrive for me to mix also contain additional documentation like meta data etc. These files need to be copied to the "bounced files" folder as part of my mix prep process. Right now I am manually copying them and pasting them. Is there a way to copy these files, find the current open session directory and past them into the "bounced files" folder of that session?

    • 2 replies
    1. Chad Wahlbrink @Chad2023-10-21 13:03:32.016Z2023-10-21 13:45:30.809Z

      Hey @Lynn_Graber!

      A few approaches to this idea.

      First, here's how to get some basic file information from either the active Pro Tools Session:

      // From Pro Tools
      let currentSessionPath = sf.app.proTools.getSessionPath().sessionPath.split(':').join('/').slice(1);
      // /~/Desktop/Song 02 MIX/Song 02 MIX01.ptx
      
      let currentSessionName = sf.app.proTools.getSessionPath().sessionPath.split(':').pop();
      // Song 02 MIX01.ptx
      
      let currentSessionFolder = sf.app.proTools.getSessionPath().sessionPath.split(':').slice(0,-1).join('/').slice(1) +'/';
      // /~/Desktop/Song 02 MIX/
      
      let currentSessionBouncedFilesFolder = sf.app.proTools.getSessionPath().sessionPath.split(':').slice(0,-1).join('/').slice(1) +'/Bounced Files/';
      // /~/Desktop/Song 02 MIX/Bounced Files/
      

      Or the Finder Selection

      // From Finder
      let currentFinderSelectionPath = sf.ui.finder.selectedPaths[0];
      // /~/Desktop/Song 02 MIX/Song 02 Notes.pdf
      
      let currentFinderFileName = sf.ui.finder.selectedPaths[0].split('/').pop();
      // Song 02 Notes.pdf
      
      let currentFinderSelectionParentPath =  sf.ui.finder.selectedPaths[0].split('/').slice(0,-1).join('/')+'/';
      // /~/Desktop/Song 02 MIX/
      
      let currentFinderSelectionBouncedFilesFolder = sf.ui.finder.selectedPaths[0].split('/').slice(0,-1).join('/')+'/Bounced Files/';
      // /~/Desktop/Song 02 MIX/Bounced Files/
      

      Now you can use this information to do basic file operations like Open 'Bounced Files' for current Pro Tools Session:

      let currentBouncedFilesFolder = sf.app.proTools.getSessionPath().sessionPath.split(':').slice(0,-1).join('/').slice(1) +'/Bounced Files/';
      
      sf.file.open({path:currentBouncedFilesFolder});
      

      To move files, we need to provide SoundFlow with the

      "Source Path" - /~/Desktop/Song 02 Notes.pdf
      "Destination Path" - /~/Desktop/Song 02 MIX/Bounced Files/ + Song 02 Notes.pdf

      Note that in the destination path, we need to append the file name to the path of the Bounced Files folder to complete the operation.

      To move a single file from the current selection in Finder to the current Pro Tools session's "Bounced Files" folder, we can use:

      let currentFinderSelectionPath = sf.ui.finder.selectedPaths[0];
      
      let currentFinderFileName = sf.ui.finder.selectedPaths[0].split('/').pop();
      
      let currentFinderSelectionBouncedFilesFolder = sf.ui.finder.selectedPaths[0].split('/').slice(0,-1).join('/')+'/Bounced Files/';
      
      sf.file.move({sourcePath:currentFinderSelectionPath, destinationPath: currentFinderSelectionBouncedFilesFolder + currentFinderFileName});
      
      

      Finally, to move all selected files from the Downloads folder, or any folder, to the current Pro Tools session's "Bounced Files" folder, we can use:

      let currentSessionBouncedFilesFolder = sf.app.proTools.getSessionPath().sessionPath.split(':').slice(0,-1).join('/').slice(1) +'/Bounced Files/';
      
      sf.ui.finder.selectedPaths.forEach(currentFinderFile => {
          let fileName;
          // if the selected file is a folder, keep the '/' as part of the fileName
          if(currentFinderFile.split('/').slice(-1)[0] === ''){
              fileName = currentFinderFile.split('/').slice(0,-1).slice(-1)[0] + '/';
              sf.file.directoryMove({sourcePath:currentFinderFile, destinationPath: currentSessionBouncedFilesFolder + fileName });
          // if the selected file is a file
          } else {
              fileName = currentFinderFile.split('/').slice(-1)[0]
              sf.file.move({sourcePath:currentFinderFile, destinationPath: currentSessionBouncedFilesFolder + fileName });
          }
      })
      

      Note, that there is a bit of added complexity because we need to differentiate manipulation of the naming when moving a folder (aka directory) or moving a file.

      1. LLynn Graber @Lynn_Graber
          2023-10-23 14:24:39.174Z

          The first one gave me an IO exception trying to copy a single file. However, the second one worked great to select multiple files and move them. So great. :)