Category: tips

Rsync backup

The scripts, below, allow you to sync directories or drives easily. Great for backups.

Save the scripts to text files with the .sh extension. Make them executable (chmod +x).

#!/bin/sh if [ $# -ne 2 ]; then echo 1>&2 "USAGE: /source/dir /backup/dir/" exit 127 fi rsync --delete -av "$1" "$2"

Usage, in terminal window: path/to/ /source/dir/ /backup/dir/. It is recommended to set up, second script below, to execute and supply the arguments for source directory and target backup directory.
Customize the paths to the script, your source directory and the target backup directory.

~/scripts/ /Volumes/sourceDir/ /Volumes/backupDir

Execute the script in a terminal window (drag and drop and hit enter, or enter the path to the script and hit enter), or set up a cron job to execute this script on a schedule.

Important note!
Seems that sometimes we need to run rsync as superuser, to allow the “–delete” flag to do it’s work deleting or moving files that you have deleted or moved on your source directory. So you can run as superuser by typing:

sudo ~/scripts/ /Volumes/sourceDir/ /Volumes/backupDir

I recommend testing these scripts thoroughly, with temporary directories and files, before using them on valuable data!

Using Maya hsvToRgb to cycle through the color spectrum

HSV to RGB is a utility node that allows you to convert an HSV (Hue-Saturation-Value) color into an RGB (Red-Green-Blue) color.

.inHsvR ranges from 0 to 360, representing degrees of a circle. We can use this to animate a shader to run through all the rainbow colors.

This MEL script will create and assign this shader network to selected objects.

Rename multiple files with Mac shell script

Simple renaming and renumbering script for multiple files

num=0 for j in *.jpg do mv "$j" `printf "myFILE.%05d.jpg" $num` num=`echo "$num + 1" | bc` done

Usage: In any text editor, modify the script so that the extension in the second line (here .jpg) exactly matches the extension of the files you want to modify. Also, change the file name in line four (here myFILE) to whatever name you want to use. In the Terminal, cd to the directory with your files. Paste the script to the terminal, hit enter.

Note, the way this is set up, the script will rename every file of the specified .extension in the current directory.

Replace file name suffix:

Another script. This script changes the suffix of each specified file in a directory. In this example from “myName_000_01.JPG” to “myName_000.jpg”

for i in *.JPG do mv $i `basename -s _01.JPG $i`.jpg done

Edit the the first line of the script so that it works on the appropriate files. In this example we have several files that have the extension of .JPG in common. Each of these files will be renamed.

The “mv” unix command is used to rename the files. Using the “basename” utility and the “-s” flag we can designate what part original name we want to keep, rather the suffix we want to remove. In this example the suffix we want to remove is “_01.JPG”.

Specify the new suffix that you want to add (here it’s “.jpg”).

Next, open a terminal window. Navigate to the directory where your files reside. Enter “sh” in the window, hit enter. Paste the script, and hit enter. That’s it.

scripts written with the assistance of Jeshua Lacock of

Slider Control in After Effects

You can link the Slider Control expression control to properties in After Effects to create a gui slider interface with a key-able value. An easy way to do this is to do the following.

  1. Make a null layer. Apply the Slider Control expression control effect to the null layer.
  2. Create an expression by option/alt clicking on the “stopwatch” of the property.
  3. Use the pick whip to connect the property to the Slider Control.

You can also link individual values of properties, the x position for example, to the slider if you highlight that value and then connect via the pick whip. You must be able to access the individual arrayed values of the property, so write your expression as below, for example:


Highlight the value “position[1]” then use the pick whip to connect to the Slide Control. You will get this new expression as a result (if your null is named controllerNull):

[position[0],thisComp.layer("controllerNull"). effect("Slider Control")("Slider")]

Download example scene

The following expression is used to link a series layers to the slider. The “index” value is used to echo the layer number, here the z position of a 3d layer. The slider control is used as a multiplier on that value. The result is an accordion like effect.

[position[0],position[1], index*thisComp.layer("controllerNull").effect("Slider Control")("Slider")]

After Effects tips

Command + forward slash (apple), or control + forward slash will bring selected footage items into an open composition.

Command + option + forward slash (apple), or control + alt + forward slash will replace selected footage in the timeline with selected footage from the project panel.

Hit the asterisk key on the numeric keypad to add a layer marker to a selected layer at the current point in time.

Command/control + Y creates a new solid. Command/control + shift + Y opens solid settings.

Press the u key to reveal all key frames. Press uu to reveal all modified parameters.

To match the work area to a layer’s duration: select the layer, then type “ibon“. i sends the time indicator to the in point of the layer, b sends the in point of the work area to match the time indicator. o sends the time indicator to the outpoint of the layer, n sends the out point of the work area to the outpoint of the time indicator. Better yet use command+option+b to match the work area to the duration of all selected layers.

Use the bracket [] keys to move layers in/out to the time indicator. Option+bracket will crop the in/out points to the time indicator.

To go to the first or last frame of the work area, press Shift+Home or Shift+End.

Show only properties with keyframes or expressions: Press U

After Effects Keyboard Shortcuts