2

I have the arduous task of restoring an old fcp project and I hit a roadblock with a whole bunch of .mov files that were moved to a NAS which altered the resource map of the files (the resource fork apparently broke?!). I have to use FCP7 on a mac running OSX 10.10 and unfortunately this computer can't play the .mov files (VLC can play them fine.) I found online an old blog written by Florian Bogner in which he wrote a great terminal script that fixes the extended attributes of one file at a time. Can anyone suggest the best way to run this script on a folder of hundreds of .mov files?

Here is the script:

#!/bin/bash

clear 
echo '   ____ _______ ______   ______            ______ _______   __'
echo '  / __ \__   __|____  | |  ____|   /\     |  ____|_   _\ \ / /'
echo ' | |  | | | |      / /  | |__     /  \    | |__    | |  \ V / '
echo ' | |  | | | |     / /   |  __|   / /\ \   |  __|   | |   > <  '
echo ' | |__| | | |    / /    | |____ / ____ \  | |     _| |_ / . \ '
echo '  \___\_\ |_|   /_/     |______/_/    \_\ |_|    |_____/_/ \_\'
echo ''
echo ''
echo 'This tool tries to fix the error message'
echo '  "Resource map is incorrect"'
echo 'as reported by Quicktime 7 based Applications.'
echo ''
echo 'Please drop the broken QT7 file into this window and press return:'

while read; do
    # trim the filename
    FILE=$(echo "$REPLY"| sed -e 's/^ *//' -e 's/ *$//')

    # check if the file exists
    if [ -f "$FILE" ]; then
        break
    else
        echo "Can't read this file. Please drop a valid one."
        echo "'$FILE'"
    fi
done


# check if there are EAs
echo ""
LINES=$(xattr -l "$FILE"|wc -l)

if [ "$LINES" -eq "0" ]; then
    echo "Can't fix this file"
    echo "There are no extended attributes associated."
    exit 1  
fi

# now remove the EAs
echo ""
xattr -c "$FILE" &>/dev/null
echo "You can now open this file in QT7."

# create space
echo ""

Thanks to anyone that can assist me in this matter. Cheers

3

The only line that does work in that script is

xattr -c "$FILE"

To run a command on all files in a folder, use find:

find /path/to/folder -type f -exec xattr -c "{}" \;

xattr also provides the -r flag to run recursively, so you can avoid find given that this functionality is part of xattr:

xattr -rc /path/to/folder
| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .