• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Alias Files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alias Files


  • Subject: Re: Alias Files
  • From: "Jonathan Levi, M.D." <email@hidden>
  • Date: Thu, 13 Sep 2007 01:16:02 -0400

On Wed, 12 Sep 2007 12:21:50 -0500, Luther Fuller <email@hidden> wrote:
I ran into a problem late yesterday. I'll spare you all the gory details and offer this problem instead ...

	A folder contains two files exactly, one of the files is an alias file
	pointing to the other file. Write a script that will remove ONLY
	the alias file from this folder.

If the alias file was created by Mac OS X, then the problem is easy to solve. Ask the Finder for a list of the contents of the folder, then find and delete the item whose 'class of item ...' is 'alias file'.

But, what if the alias file is a symlink? (The folders I'm actually dealing with are from an ISO 9660 CD)
I'm thinking that it can't be done.

I think it could, with something like (not actually tried)

on isSymLink(aFinderItem)
  tell application "Finder" to set itemPath to (aFinderItem as string)
  set itemPathUQ to quoted form of Posix path of itemPath
  set shellResult to do shell script ("ls -l " & itemPathUQ)
  return (shellResult contains " -> ")
end isSymLink

Obviously this could be fooled, if you have a Finder item whose name contains " -> " -- but I think you get my idea.

hth,

Jonathan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Prev by Date: Re: fileMaker Value Lists
  • Next by Date: Re: rsync do shell script password..
  • Previous by thread: Re: Alias Files
  • Next by thread: Re: Alias Files
  • Index(es):
    • Date
    • Thread