How can I get the size of a file with apple script

I try to get the size of a file within an apple script. But I did not find information how to do this.

There are two ways. I think Apple is moving toward using System Events, which is listed first.tell application "Finder"
set myFile to selection as alias
--this just gets a file for me to work with
--coercing it into an alias is required for the other functions
end tell
tell application "System Events"
get size of myFile
end tell
set myInfo to (info for myFile)
get size of myInfo

Similar Messages

  • How can I get the size of a file

    I want the size by BYTE.

    [url http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#length()]File.length()

  • How can i change the size of PDF files ?

    how can i change the size of PDF files? when i convert documents in the acrobat browser it seems the files become larger then normal pdf files, this is, i compare with other files that people send to me and i realise that they are smaller than my converted files, even if they have more pages.

    A lot depends on the form of the PDF. Is it graphics, a scan of a text file, pure text, or other? What version of Acrobat are you working with.
    You can do a save as to get a WORD file, but do not expect great results. The ability to get a decent WORD file depends on what the form of PDF you are working from. If it was created from WORD with tags and all, you might get good results. If not, you might get a lot of messed up results.
    Explain what you are starting with and your ultimate goal. Also check the audit of the file (should be under PDF Optimize) to see where the file information is concentrated (text, fonts, graphics, other).

  • I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio

    I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio 2013?

    For MS Visio (any version) only the appropriate version of Acrobat *PRO* provides PDFMaker for Visio.
    For Visio 2013 specifically you must have Acrobat XI Pro (updated to at least 11.0.1).
    See: 
    http://helpx.adobe.com/acrobat/kb/compatible-web-browsers-pdfmaker-applications.html  
    Be well...

  • How can i get the "Do recursive listing.vi" with teh sub-vi, because my is lost???

    How can i get the "Do recursive listing.vi" with the sub-vi, because my is lost???
    THX

    I think you must be using LV 8.x...
    Do a LabVIEW repair to get it back or else, use the attached one.
    - Partha
    LabVIEW - Wires that catch bugs!
    Attachments:
    Recursive File List.vi ‏33 KB

  • How can I get my games to run smooth with apple tv. I'm getting jerky movement

    How can I get my games to run smooth with apple tv?

    Check your network for interference (www.istumbler.net, check router manual in regards to changing channels) and other activities possibly running in the background.

  • How can I perform the conversion of pdf files in Cyrillic script to Word files in Cyrillic script. The pdf file is too small for me to read right now. Julyan Watts

    How can I perform the conversion of .pdf files in Cyrillic script to Word files in Cyrillic script. The .pdf file is too small for me to read without a magnifying glass, and the document is more than one thousand pages.

    This answer was not helpful. First of all, I could not find "tech specs"
    anywhere on the Acrobat 11 homepage. And secondly I purchased this software
    for the specific purpose of converting .pdf files to Word. It was only
    after I had completed the purchase that I learnt that Acrobat does not
    permit the conversion of .pdf files in Cyrillic to Word files  in Cyrillic.
    I feel that Acrobat should have provided this crucial information before I
    allowed my credit card to be debited. That is why I  am now asking for my
    money back. But thanks for your attempt to solve my problem, even if it was
    not successful.
    Julyan Watts

  • How can i get the length of a string with Simplified Chinese?

    when i use eventwriter to add content to a xmldocument,there are some chinese simplified string in it,i use String.length() for the length ,but it is not correct~how can i get the right length for eventwriter?

    Below is a simple patch for this problem. Using this patch you need to pass 0 as the length argument for any XmlEventWriter interfaces that take a string length.
    Regards,
    George
    diff -c dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp
    *** dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp    Fri Nov  3 12:26:11 2006
    --- dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp      Thu Mar 15 13:58:13 2007
    *** 234,239 ****
    --- 234,241 ----
            CHECK_NULL(text);
            CHECK_SUCCESS();
    +       if (!length)
    +               length = ::strlen((const char *)text);
            if (!_current)
                    throwBadWrite("writeText: requires writeStartDocument");
            try {
    *** 413,418 ****
    --- 415,422 ----
            CHECK_NULL(dtd);
            CHECK_SUCCESS();
    +       if (!length)
    +               length = ::strlen((const char *)dtd);
            if (_current) {
                    if (!_current->isDoc())
                            throwBadWrite("writeDTD: must occur before content");
    diff -c dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsWriter.cpp dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsWriter.cpp
    *** dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsWriter.cpp Tue Jan  2 16:01:14 2007
    --- dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsWriter.cpp   Thu Mar 15 13:59:25 2007
    *** 326,331 ****
    --- 326,333 ----
                    needsEscape = false;
            else
                    needsEscape = true;
    +       if (!length)
    +               length = ::strlen((const char *)chars);
            writeTextWithEscape(type, chars, length, needsEscape);
    *** 336,341 ****
    --- 338,345 ----
                                  bool needsEscape)
            if(_entCount == 0) {
    +               if (!len)
    +                       len = ::strlen((const char *)chars);
                    if ((type == XmlEventReader::Characters) ||
                        (type == XmlEventReader::Whitespace)) {
                            char *buf = 0;
    *** 381,386 ****
    --- 385,392 ----
      NsWriter::writeDTD(const unsigned char *data, int len)
            if(_entCount == 0) {
    +               if (!len)
    +                       len = ::strlen((const char *)data);
                    _stream->write(data, len);
      }

  • I synced firefox information to the servers and exchanged my laptop. How can I get the new laptop to sync with my firefox data?

    I want to get my firefox sync data on my laptop. However, I haven't paired this device, I just have my information on the firefox servers under my account. How can I get the sync info on this new laptop?

    If you don't have a 2nd device available which is already setup with your Sync account, pairing can't be done.
    In order to set up a '''new device''' when you can't "pair", you need three things; the user account name ''(email address used)'', the password for the account, and the '''Sync Key'''.
    If you didn't make a copy of the Sync Key as prompted at the end of the Sync set up process, you can't successfully setup a new device and won't be able to recover your data.

  • How can we get the web cam to work with sykpe or any out going calls

    can get the web cam to work with skype

    Hey there,
    What model laptop is this? Are you using the built-in webcam or is this a external web cam? Also what operating system are you using?
    Thanks!
    Sean
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • How can u get the Length of a file u are going to download?

    HI,<br>
    I have another question, is it possible that u can get the length of a file which u are just going to download?<br>
    <br>
    I have the following code example:<br>
    <br>url = new URL(dlfrom);<br>
    f=new File(url.toURI());<br>
    System.out.println(f.length)();<br><br>
    unfortunatly it keeps throwing an exception, please help.

    RTFM
    http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLCo
    nnection.html#getContentLength()<br>
    I tried to apply your sollution, but it is allways returning -1, so what should I do now, is there any possebility still to get the length of the object, because i thought of doing something similar as a tool to download stuff

  • How can I get the size of all lines or the last line number in a DB?

    I want to display a certain number of lines from a DB.
    But before I fetch them out, I must know how many lines of this DB has.
    I donnot know if there is some methods have this function. I know the last() method can move the cursor to the last line, but some DB cannot support this function.
    Could someone know the answer or some examples about displaying data in a jsp?
    Thanks a lot.

    To get the number of rows in a ResultSet, loop over the result set with while(res.next()). Read each row into an object. Add each object into a, say, LinkedList. At the end, you will have the rows nicely converted to objects (which you probably should do anyway), and list.size() will give the number of objects.
    There are other ways to get the number of objects, but list.size() is the easy and reliable way. If you don't need the rows converted to objects ...why did you select them in the first place?
    Tricks with last() and whatnot sort of work. They read the entire result set into memory. But you'll need to write the while(res.next()) loop anyway. No point in having the computer do the same thing twice.

  • How can I get the size of conatiner which is kept in the array of conatiner?

    I have created an Array of Conatiner in Local variable (say Locals.Array_C). Within Array_C, I have few containers like Cont_1, Cont_2, Cont_3.
    Lets consider that there are four(4) Number fields added in the Cont_2.
    Here the number of elements in the Cont_2 is 4, but if I want to read this size through TestStand, how can I do that?
    I also tried to use "Call PropertyObject.GetNumElements" ActiveX property, but I could not get how to set Object Refernce in this case.
    Please help.
    Solved!
    Go to Solution.
    Attachments:
    Locals.Array_C.JPG ‏67 KB

    Hi,
    Your problem is how you are specify the array part. It may also be what you are using as the reference.
    Lets look ate the array part using the SequenceContext as the reference. The lookup string will be:
    "Locals.Array_C[1].Cont_2.Elemen4"
    If you are using the Locals as the reference the lookup string will be:
    "Array_C[1].Cont_2.Element4"
    Hope this helps
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How do I get the size of a file on a server with an Applet

    Hei,
    I have a problem. I have some files that I need to read in with InputStream to get an Array of bytes. The Applet and the files are on the same server.
    My Prob is, that when I use
    URL(daFile).getFile().getSize();
    it only gives the inaccurate size from the dirlisting (i.e. 48 for 48k)
    So I can not build an array with the correct Size.
    Does anyone knows how I get the correct size of a file.
    Big thx
    LoCal

    Appler can open connections to server it was downloaded from. You don't need such complicated API as RMI... Just simple java server listening for queries.
    Like this:
    Applet:
    1. take a file path
    2. connect to simple server (gives OutputStream and InputStream)
    3. create ObjectOutputStream and send fiel to server (File is serializable)
    4. Read String with size from input stream
    Server
    1. Wait for connection
    2. When client connected create ObjectInputStream and expect File instance
    3. Get file size
    4 Replay with String with size
    Like this...

  • How can I limit the size of a file generated by 3rd party code?

    I have a program that loads plugins from a directory and executes code in those plugins. These plugins are classes that implement a standard interface within my API. I want to be able to monitor for files generated by these plugins. Usually there are no more than 2 plugins running at once, so I could end up with 2 plugins writing files. An example would be a plugin creating an SQLite database on the filesystem.
    I could monitor the current directory and guess who's file it is, but what if the files get written elsewhere? Can I do something in Java that limits what directories the Java process can write to?
    I wouldn't mind being able to track their memory and CPU usage, but I don't think I can do much about that.

    Thank you. I just needed to be pointed in the right direction. After looking over this stuff, including FilePermission, I think this may give me what I was looking for. It will be a while before I get to implementing it or testing something like this, I'm just trying to get a grasp on all of the things I need to do and how to approach it.
    By doing this I can control how much filespace it can use.
    I can control CPU usage by monitoring for extra threads that don't belong and killing or settings the priority on it.
    Now I just need to think of something to monitor how much memory the plugin uses. I suppose I could gc, then store the current memory usage, then execute the plugin, gc again, and measure the size again. Does that sound like a reasonable way to estimate it's memory usage? I'm not looking for tiny changes, I just want to see large, substantial increases.

Maybe you are looking for

  • Installing BC 2.1 on a Virtual Machine (Xp Pro)

    I run VMWare Fusion on top of Boot Camp 2.0. The Fusion virtual machine is running Xp Pro. Can I install BC 2.1 from the virtual machine's Xp or should I quit Fusion and install BC 2.1 from the simple Boot Camp Xp "side" of my computer? Anyone have a

  • Options for streaming media from my macbook to my tv?

    Hello All, I am a novice when it comes to this kind of stuff so bear with me! I have a macbook pro (Mid 2012) and a Panasonic Flat TV - I currently use a cable from my macbook to my tv for watching video files of all kinds and to watch netflix (where

  • Cannot open hyperlinks in excel

    I created hyperlinks to files in other folders on my computer, then later added some more. When I tried to open the new ones I received an error message, then I tried opening the old ones and received error message for those as well.  What is the pos

  • Assessable Value/ Excise Base

    Hi Experts, My client buys material from a importer who includes all excise and Addtional duties in PO Price. Ex: Unit Price: INR 80 BED: INR 8 Ecess: INR 3 HS Ecess:INR 2 Additional duties: INR 7 PO Price: INR100 and CST : INR 2 (2% on PO price) Now

  • Photomerge not including all photos - confused!

    Hi, I am using Photoshop CS5 12.0.3 to stitch together some panoramic photos using Photomerge but am encountering the following problem and would appreciate any advice. I have 3 photos of a panoramic scene taken by the same camera with the same lens,