Created
January 5, 2011 17:53
-
-
Save drocamor/766683 to your computer and use it in GitHub Desktop.
To help sort out your multipass renders!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# sort_renders.sh - Sorts multipass renders in a given directory | |
# usage: sort_renders.sh [directory] | |
## Here are some things to customize: | |
# Populate this with a list of all the pass names seperated by spaces | |
PASSNAMES="foo bar baz quux _ao" | |
# Set this to cp to copy or mv to move | |
COPY_OR_MOVE="cp" | |
## And here is the program: | |
function printUsage { | |
echo Please provide a directory of renders to sort | |
echo Usage: $0 [directory] | |
exit 1 | |
} | |
# Check for a directory | |
if [ -z $1 ]; then | |
printUsage | |
fi | |
DIRECTORY=$1 | |
# Find files in the unsorted directory that match the passname and move or copy them | |
for PASS in $PASSNAMES; do | |
echo Processing $PASS | |
find $DIRECTORY -maxdepth 1 -type f -name "*_$PASS*" -exec mkdir -p $DIRECTORY/$PASS ';' -exec $COPY_OR_MOVE {} $DIRECTORY/$PASS/ ';' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment