Re: How to detect a file has resource fork, or not?
Re: How to detect a file has resource fork, or not?
- Subject: Re: How to detect a file has resource fork, or not?
- From: Doug McNutt <email@hidden>
- Date: Mon, 15 Mar 2004 10:12:23 -0700
At 15:11 +0800 3/15/04, Bill wrote:
>
Anyone has idea how to detect a file has, or hasn't resource fork, by applescript? The environment is Mac OS X 10.3.2, on HFS+.
In my .tcshrc file I have this alias.
alias files ls -lF \*/..namedfork/data \*/..namedfork/rsrc
The name is chosen because it works like MPW's files command which in turn is a bit like ls in Darwin.
The globbed and escaped *'s can be replaced by the actual name of the file you want to study. Don't be fooled by the /.. syntax. It is not a subdirectory. It is an extension added to HFS+ for OS neXt that allows for resource forks.
For instance, in my case I have a BBEdit file MountEm in my home directory which yields up:
cd $HOME
ls -lF MountEm/..namedfork/data MountEm/..namedfork/rsrc
-rw-r--r-- 1 doug suntide 782 2 Feb 16:21 MountEm/..namedfork/data
-rw-r--r-- 1 doug suntide 1710 2 Feb 16:21 MountEm/..namedfork/rsrc
Note that both resource and data forks show up with sizes for each If the resource fork does not exist it will still show but with a size of zero.
It ought to be fairly easy to use POSIX_path_to and quoted_form_of with do_shell_script to make it all work in AppleScript. There are other options to the ls command and it's probably possible to show only the lengths of the forks. I doubt if AppleScript will get POSIX path to resource fork of file "MountEm" but there is no real reason it shouldn't add the "/.. namedfork/rsrc" extension.
--
Applescript syntax is like English spelling:
Roughly, but not thoroughly, thought through.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.