• 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: Server Space
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Server Space


  • Subject: Re: Server Space
  • From: Daniel Jalkut <email@hidden>
  • Date: Mon, 12 Sep 2005 12:57:16 -0400

What kind of server? If it's a server that mounts on the Finder as a "disk" then it's pretty easy. For instance, this code works well for my "Shared Docs" folder mounted from my PC to my Mac:

set myDiskName to "SHAREDDOCS"
tell application "Finder"
set myServer to disk myDiskName
end tell
display dialog "The server '" & myDiskName & "' has " & FreeSpaceOnDisk(myServer) & " available"


on FreeSpaceOnDisk(inDisk)
    tell application "Finder"
        set myFreeSize to free space of inDisk
        return my ReadableValue(myFreeSize)
    end tell
end FreeSpaceOnDisk

on ReadableValue(inSize)
    set unitTextCode to 0

    repeat while (inSize > 1024)
        set inSize to inSize / 1024
        set unitTextCode to unitTextCode + 1
    end repeat
    return (inSize as string) & " " & WordForUnitCode(unitTextCode)
end ReadableValue

on WordForUnitCode(inCode)
    if (inCode is equal to 0) then return "Bytes"
    if (inCode is equal to 1) then return "Kilobytes"
    if (inCode is equal to 2) then return "Megabytes"
    if (inCode is equal to 3) then return "Gigabytes"
end WordForUnitCode



On Sep 12, 2005, at 10:44 AM, Steve Suranie wrote:

Is it possible to have AppleScript return the space available on a remote
server?


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (Applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
40red-sweater.com


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Server Space (From: Steve Suranie <email@hidden>)

  • Prev by Date: Re: exit this repeat loop
  • Next by Date: Re: exit this repeat loop
  • Previous by thread: Server Space
  • Next by thread: Re: "Numeric overflow"?
  • Index(es):
    • Date
    • Thread