#!/bin/bash
# # Takes rstored Curator projects, clones the project folder to a staging loaction # Re-wraps the content into the staging location # Moves the staging folder to the pickup folder # Moves the source folder to a processed folder #
echo “Script running”
# Do some stuff so we can handle whitespace in filenames
OIFS=“$IFS” IFS=$'\n'
# Find the restored Curator project folders
for D in $(find /mnt/isilon/turner/ipv/CEE/ -mindepth 1 -maxdepth 1 -type d)
do
# Get the basename of the directories
OUTPUT=${D##*/}
echo $D
# Make the staging folder
mkdir -p /mnt/isilon/turner/ipv/staging/“$OUTPUT”
# Find the files in the restored folder
for FILE in $(find /mnt/isilon/turner/ipv/CEE/“$OUTPUT”/ -mindepth 1 -maxdepth 1 -type f)
do
# Get the basename of the files and remove the file extenstion
FILENAME=$(basename “$FILE”) EXT=${FILENAME##*.} FILENAME=${FILENAME%.*}
echo $FILE;
# Carry out the Omneon re-wrap to MXF
/usr/local/bin/ommcp -in “$FILE” -out /mnt/isilon/turner/ipv/staging/“$OUTPUT”/“$FILENAME”.mxf -embedded -progress
#echo “$FILE” #echo “$output_folder”/“$FILENAME”.mxf
done
# Move the folder from staging to pickup
mv /mnt/isilon/turner/ipv/staging/“$OUTPUT” /mnt/isilon/turner/ipv/pickup/CEE/“$OUTPUT”
FILESIZE=$(stat -c%s /mnt/isilon/turner/ipv/pickup/CEE/“$OUTPUT”) echo “output file size = ${FILESIZE}”;
#Move the original folder to the processed folder
mv /mnt/isilon/turner/ipv/CEE/“$OUTPUT” /mnt/isilon/turner/ipv/processed/CEE
done
IFS=“$OIFS”
echo “script done”
exit