Keeping Mobile Avid Media Updated

On most of the films that I’ve worked on, I’ve needed to keep at least two Avid systems up to date. This could be because an editor wants to be able to cut from home, or the Director wants the ability to cut on set. To handle this I wrote a Terminal (bash) script that searches for any new MXF or OMF media on specified volumes since the last time the script was run. On first-run, the script does nothing but set the date to compare against the next time the script is run, though if you need to change that instructions are below.

How It Works

Essentially, this script is nothing more than a find command. When it first runs, it creates a file called touch.txt in the current user’s home directory (so named because of the command that creates it). The next time the script is run, it compares the current date and time to the modification date and time of touch.txt. Any MXF or OMF file that is newer than that modification time gets copied to a folder on the Desktop called outgoing, and touch.txt gets updated with the current time to prepare for the next time you run it. You would then copy the outgoing folder to a portable hard drive (or modify the script to copy directly to it), and load up your mobile Avid or additional Unity with that media.

Bi-Directional Updates

I haven’t needed to keep two Avid setups synced in both directions yet, but I provided this script to another show that did. Their method was to have an “Incoming” workspace/partition on both systems that was not in the script’s volumes list, which served to keep media copied from one system isolated from media that originated on the other. If you didn’t do this, since the script only compares dates you would end up transporting the same media back to where it originally came from.

The Script

#!/bin/bash
# This script copies changed MXF and OMF media newer than the file /touch.txt

# Customize with your partition/workspace names, separated by a space (case-sensitive)
# Destination directory is currently set to the current user's desktop,
# but something like '/Volumes/Shuttle_Drive' would work, too
# touchpath sets where the comparison files should be stored. Default is the user's home directory
volumes='MEDIA_01 MEDIA_02 MEDIA_03 MEDIA_04 PROJECT'
destdir=$HOME'/Desktop/outgoing'
touchpath=$HOME

# Don't edit below here
# ===============================
time=`eval date +%y%m%d%H%M`

# If touch.txt doesn't exist where expected, create it and stop processing.
if [ ! -f $touchpath/touch.txt ]
then
touch -m -t $time $touchpath/touch.txt
exit
fi

# Since touch.txt exists, temporarily create touch2.txt with the same mod date.
# A second temp file is created to account for the difference in time between when
# the script is run and when it finishes.

touch -m -r $touchpath/touch.txt $touchpath/touch2.txt	
touch -m -t $time $touchpath/touch.txt
mkdir -p $destdir/MXF $destdir/OMF

# Loop through workspaces and run copy commands
for directory in $volumes
do

# FIND NEWER MXF FILES
find /Volumes/$directory/Avid\ MediaFiles -name "*.mxf" -newer $touchpath/touch2.txt -type f -exec cp -vn {} $destdir/MXF \;

if [ -d "/Volumes/$directory/OMFI\ MediaFiles" ]
then
find /Volumes/$directory/OMFI\ MediaFiles -name "*.wav" -newer $touchpath/touch2.txt -type f -exec cp -vn {} $destdir/OMF \;
fi

# If growl is installed, give notifications
type growlnotify &>/dev/null && growlnotify -n rsync -m "$directory Avid Media copied" "Copy Finished"
done

# Remove temp touch file
rm $touchpath/touch2.txt

How to Change the First-Run Comparison Date

Run the following command in Terminal before running the script, substituting your desired comparison timestamp in the format YYYYMMDDHHMM. Here’s an example if I wanted the first run of the script to find all new media since July 8th, 1982 at 8:12pm. It will create the file in your home directory.

touch -m -t 198207082012 $HOME/touch.txt

Attachments:

Mission: Impossible 4 Formats and Aspect Ratios

Next Article

Mission: Impossible 4 Formats and Aspect Ratios

In terms of workflow, planning for MI4 was certainly a challenge. We had six camera formats including 35mm; 65mm; and RED, as well as three release formats for normal theaters, IMAX Digital, and IMAX Film. Keeping all of that together took a little bit of effort.

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  1. Hey, cool solution! Relatively simple and easy to implement.

    How is this different from using a backup program (a la Synchronize Pro or Rendezvous)? Theoretically you could input the same parameters into the backup scripts and have them run automatically if needed. Also, does your script compare modify dates or creation dates on the MXF files? What I’m getting at is if you had to add archived bins/media into the Avid, your script may pass over them since it is not “newer” than your touch.txt modification date.

  2. Couldn’t find any info on Rendezvous, but one of the biggest advantages over Synchronize Pro is that this is free and already built into OSX. Also, this is pretty tailored to Avid media, in that MXF files from a bunch of different directories end up all copied to the same one, which would be ideal for copying to another system. I haven’t used Synchronize but most of these tools that do incremental backups will recreate the directory structure of the files they find to copy, which is good for backups but not good for this purpose. This script also knows to separate MXF and OMF into different folders since they’ll need to go in separate folders at the destination system as well.

    I don’t generally deal with archived media (this script is not good for bins, by the way, because bins get updated all the time even if no changes were made), but you have two choices if you do. One is that when you copy your archived media to your main system, you also copy it to your portable drive at the same time and bypass the script completely. The other is that you use the same touch command I use in the script to update the modification date of the files, and then copy them. I’d prefer the former if I were doing it