• 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: easy way to check if item is file or folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: easy way to check if item is file or folder


  • Subject: Re: easy way to check if item is file or folder
  • From: Jolly Roger <email@hidden>
  • Date: Wed, 20 Dec 2000 15:01:22 -0600
  • Replyto: email@hidden

on 12/20/2000 2:10 PM, Jon Kreisler wrote:

> This has worked:
>
> set x to "Macintosh HD:Desktop Folder:File_A"
> set xInfo to info for alias x
> set xFolder to folder of xInfo
> display dialog "Folder is:" & xFolder as text

Using "info for" will be slow and can fail if the folder contains more than
2 gigabytes of data.

Use string manipulation instead - it's faster, and cannot fail if the folder
is too large:

set thePath to (choose file) as text
set isFolder to ((character -1 of thePath) = ":")
log the result

set thePath to (choose folder) as text
set isFolder to ((character -1 of thePath) = ":")
log the result

HTH

JR


References: 
 >Re: easy way to check if item is file or folder (From: Jon Kreisler <email@hidden>)

  • Prev by Date: Re: Relative path
  • Next by Date: Re: Akua Sweets (was Re: Simple 'screensaver' launcher)
  • Previous by thread: Re: easy way to check if item is file or folder
  • Next by thread: Re: easy way to check if item is file or folder
  • Index(es):
    • Date
    • Thread