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


Click here to return to the 'Stripping resource forks' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Stripping resource forks
Authored by: rtl on Apr 21, '03 04:42:59PM
For a file named "foo" in the current working directory, cp /dev/null foo/rsrc will also strip the resource fork. You can also check the size of foo/rsrc (using ls or otherwise) to see whether the file has a resource fork or not: if the size is nonzero, it has a resource fork, otherwise it doesn't. I use this script to accomplish the task in a somewhat safer manner:
#!/bin/bash

USAGE="nukersrc "

if [ $# == 1 ]
then
  if [ -f "$1" ]
  then
    if [ -s "$1/rsrc" ]
    then
      /bin/cp /dev/null "$1/rsrc"
    else
      echo "File $1 has no resource fork"
    fi
  else
    echo "$1 does not exist or is not a regular file"
  fi
else
  echo $USAGE
fi


[ Reply to This | # ]