Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 're: this can be done form the Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
re: this can be done form the Terminal
Authored by: sauy7 on Oct 30, '04 06:39:48AM
Here's a simple bash script to run in a Terminal window

#! /bin/bash
#
# Simple file unlocking utility for Mac OS X
#
ARGS=1
E_BADARGS=65

function recursiveUnlock() {
    pushd $1
    for rdir in `ls -A`; do
        if [ -d "${rdir}" ]; then
            recurse ${rdir}
        else
            /Developer/Tools/SetFile -a l ${rdir}
        fi
    done
    popd
}

if [ $# -ne "$ARGS" ]
then
    echo "Usage: `basename $0` starting-directory"
    exit $E_BADARGS
fi

recursiveUnlock $1
Usage (code saved as an excutable file recursiveUnlock.sh):

$ ./recursiveUnlock.sh /path/to/top-level/dir
unlocks all files in dir, including those in dir's sub-directories

---
sauy7

[ Reply to This | # ]

re: this can be done form the Terminal
Authored by: gwik on Mar 01, '06 09:55:25AM
$ find *the_root_dir* -type d -exec /Developer/Tools/SetFile -a l {} \;

[ Reply to This | # ]