Returning the file count of a folder--too slow

I am using the following to return the file count of a folder as part of a larger script
with timeout of 5000 seconds
tell application "Finder"
set origFolder to "Somefolder" as alias
set thePivotfiles to (every file of origFolder whose name ends with ".jpg")
return the count of thePivotfiles
end tell
end timeout
This script is rather slow to return the count of thePivotfiles--there are about 15,000 image files in the folder.
Is there a faster way for the script to do this?
Thanks.
Pedro

try using a shell script, something like :
do shell script "cd ~/SomeFolder; ls -a | wc -l"
more info here: http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
.... btw, this is the Final Cut Pro forum. :/

Similar Messages

  • File Adapter - how to get the file count from a folder

    Hi All,
    I have a requirement that have to poll a directory when the file count is reached to number N (ex:number of files avilable in folder is 5) otherwise it should wait and not pick any of the files. Is it possible to get the file count from a folder using file adapter ?? otherwise please suggest me an approach to achieve this requirement.
    Thanks,
    JJ

    Hi Sarath,
    Thank you for your reply.
    Go with the list files operation of file adapter it will gives you the number of files in the specified folder as you given. . - this step is already done.
    When the number of files reaches your count startup your webservice that which can polls the files. . . - how can i acheive this?? Have to poll the directory and process the number files - please let me know, what could be added to the webservice which is being invoked after cheking file count from parent process.
    The reason for the above question is - we cannot use ReadFile operation in second webservice because it will be automatically triggered when the file is avilable. Also SyncRead operation supports reading one file in b/w bpel process. Kindly explain me the implementation steps.
    Thanks,
    JJ

  • ITunes v10.6.1.7 "Copying files failed. The File name was invalid or too long."

    I'm trying to organize my music files using iTunes 10.6.1.7 and I keep getting the error message "Copying files failed. The File name was invalid or too long."
    I've got music folders by artist in both the iTunes Music folder and the iTunes Media/Music folder. When I add certain files by drag/drop they sometimes get lost and I don't want that to happen anymore. I used to just consolidate my music files using the File/Library/Organize Library option and that worked, however now when I do that, I get the error message.
    I'm a novice and the only online stuff I see is both confusing and refers to earlier versions of iTunes.
    My concern is that I have heard that people lose entire libraries of their music when they trry to fix things like this and I don't want that. If this is of any importance, I have several files called iTunes library and temp library. I have no idea what that all means but I'm scared to death of it.
    Also, I can't get to the "re-organize library" link at all. It won't let me.
    One thing that be of some interest is that when I pull up the properties of the music and media/music files they are marked "read only" I'm also afraid to touch that!
    Please help and please know that I am a dummy. Be kind and be clear. Step by step would be great, with images even better. Thanks.

    Perhaps nobody knows the answer? We're fellow users here answering questions in our free time when we think we've something useful to contribute.
    You can choose to *Consolidate selected tracks* with a right-click menu. Perhaps if you can identify a specific track that won't consolidate and examine the full path to the file & the path that iTunes would create when it consolidates the problem might become apparent. For example iTunes may not be able to move files if the source or destination path length exceeds 255 characters.
    tt2

  • Itunes for WIN7: attempting to copy to disk "..." failed.  The file name was invalid or too long

    itunes for WIN7: attempting to copy to disk "..." failed.  The file name was invalid or too long
    help!!

    Max. path length is 255 characters, or perhaps there are some non-displaying characters hidden there. Try dropping a song you want to add to iTunes into the Automatically to iTunes folder to see if that works any better.
    tt2

  • Copying music failed. The file name was invalid or too long.

    I went to consolidate my music, but when it got about 2/3 of the way through, it stopped with the error message, "Copying music failed. The file name was invalid or too long." I don't know which file it is referring to. How do I find this out?
    I needed to cosolidate so I could backup the entire library to DVD. Now I'm left with two partially complete libraries with many duplicates.

    To find out which file it was, look at where you were
    copying them too and see which was the last file
    copied - and then go back to your source, and go to
    the next one - it should be that one.
    I just wanted to add that I had the same issue (failure to finish copying and "invalid or too long" error msg) and at first didn't see how looking for the last file copied would work since iTunes is copying into folders.
    Duh.
    Reverse sort by date modified (newest folder at the top of the list) then drill down to the folder containing the files being copied. Voila. There was the (missing) culprit, and I knew which file to rename in the source folder.
    Thanks for the kick in the brain pan.
    Sony VAIO PCG-V505ACP Windows XP Pro

  • HT1751 I did all of the above and at the "Consolidate files" screen I clicked "ok" then it sayd "copying files failed. the file name was invalid or too long" and I had to click "OK"  I cannot consolidate the files to transport  to my external harddrive -h

    I would like to backup my itunes to my external hard drive
    I did all the steps up to "organize Liberary" which at this point I checked the box and the clicked"ok"
    it then said "copying files failed.  The file name was invalid or too long" "OK"
    It will  not let me consolidate the files so I can transfer to my external hard drive
    what am I doing wrong - any suggestions?
    thanks,

    Are you using consolidate files to bring in stray files to your main iTunes Media folder before backing up, or to copy the media folder to the external drive as part of backing up? If it is the latter then you are taking the wrong approach. See this user tip.
    Run my script Unconsolidated on the library. It will show you the remaining unconsolidated files which might give a clue as to which files iTunes is having a problem with. You can consolidate selected files in batches (select, right-click) as opposed to trying to do everything in one go. Alternatively you could try moving the remaining unconsolidated files with ConsolidateByMoving as long as this step is a precursor to a backup..
    tt2

  • I am using itunes 10 and trying to consolidate my files.  I keep getting the error "Copying files failed.  The file name was invalid or too long".  How can I indentify what file is causing this problem or resolve this issue?

    I am using itunes 10 and trying to consolidate my files.  I keep getting the error "Copying files failed.  The file name was invalid or too long".  How can I indentify what file is causing this problem or resolve this issue?

    BUMP
    Yes, I just get that message. I don't see how I could investigate this problem.
    I didn't mention that this happened when I was consolidating my library, not copying files to another computer.
    In other words, I'm using a "normal" itunes procedure, itunes won't complete it, and won't tell me exactly why or how to figure out how to fix it...
    Is there at least some easy way to tell which files were successfully copied to my itunes music folder so I can work on moving the uncopied files?
    Can anybody help me?

  • File count alternating in folder when OS9 connects to Mac OS X server

    Greeting All,
    I have a few Macs running Mac Os 9.2.2 and they connect to a Mac Pro running OS X Server 10.4.7. The problem I am having is that if there are more that say 75 files in a folder that I open to view, the files in that folder keeps jumping and the file count keeps alternating. In other words, selecting a files from the folder is nearly impossible as the files keep moving in the folder. If I connect from a mac running OS X to the said Server running 10.4.7, I don't get this problem. Nor do i get the problem if I Connect the macs running OS 9 to a server running Appleshare Ip Server software I don't get the problem. Anyone knows how I can get around this problem?

    Just out of interest, what happens if you view the folder by List View ?
    I suspect with OS9 that you're trying to read the Desktop file to see how the folder icons are laid out, but there isn't one. So maybe you're trying to create one automatically. But OSX server on Intel goes "oh no you don't, create a resource fork ? what's that ?" or OSX server doesn't know how to create a desktop file for OS9 computers. Or you don't have file permissions to create a Desktop file on the OSX Server (then OS9 usually creates a temporary file on the OS9 System Folder Preferences folder).
    Your OSX Server license will come with support to help you answer this. I suspect a quick delve into the manual will show that it may just not be possible. My company is still on OSX 10.3.9 Server, but I've spent between 2 and 3 years getting everything off OS9 so I can't help you by trying things myself (the only OS9 bootable computer we have left is the one Server runs on).

  • HT1751 Consolidating files failed.  The file name was invalid or too long.  How to trouble shoot this?

    I am trying to move my iTunes library from old XP PC to Windows 7 PC, using an external hard drive.  Using tutorial and signed in as administrator.  Trying to consolidate my library and receive error message " Copying files fail. The file name was invalid or too long".    Don't know what to do as next step.   The library is sitting on the hard drive under the Administrator ID (My Documents\My Music\iTunes\iTunes Music).  
    Any thoughts?

    You can select a group of tracks and consolidate from the right-click context menu. You coud try consolidating in batches, say all songs by artists beginning with A, then B, etc, then the other media types, until you can isolate a problem track and then try moving that by hand and fixing the broken link.
    I also have two scripts that could help you, Unconsolidated and ConsolidateByMoving. The first can make a playlist of all unconsolidated tracks, the second can consolidate a selection of tracks by moving them instead of copying.
    tt2

  • HT1751 Consolidating ITunes Library Failed - message received: "Copying files failed. The file name was invalid or too long" . Please help - how to i fix this issue?

    I consulted your website for details on how to back up my ITunes Library on my PC-found the article very helpful-I reached step 7 - clicked ok and the following message came up: "Copying files failed. The file name was invalid or too long."  Please can you help and advise what I should do or how to fix this issue.   My pc operating system is Windows 7 Home Basic

    You can select a group of tracks and consolidate from the right-click context menu. You coud try consolidating in batches, say all songs by artists beginning with A, then B, etc, then the other media types, until you can isolate a problem track and then try moving that by hand and fixing the broken link.
    I also have two scripts that could help you, Unconsolidated and ConsolidateByMoving. The first can make a playlist of all unconsolidated tracks, the second can consolidate a selection of tracks by moving them instead of copying.
    tt2

  • Where is the file count in a finder window?

    Where is the file count in a finder window now?  I have nothing in any of the view modes.

    From the Finder Menu bar View > Show status bar

  • Return the file name of the field type BLOB

    How can I create the PL/SQL procedure that return the file name of the file insert into the record with a field file_date BLOB.
    I have this table:
    TEST
    with this item:
    file_name varchar2(20)
    file_date blob
    example
    I have insert with the OraclePortal Form a record:
    file_date Upload the file c:\test1.pdf
    I want that the my PL/SQL procedure insert into the field
    file_name the value test1.pdf
    Regards
    Basilisco Giorgio

    You may be confused by the error in Excel saying “another user”. Actually Excel cannot tell who (the real human) is editing the file. Based on my research the No.1 possibility of the error is KB2626998.
    2626998  Connection to a network document is lost in the 2007 Office system or in Office 2010 after the computer resumes from standby
    http://support.microsoft.com/kb/2626998
    For Excel 2010, follow these steps:
    a.  Click Start , click Run , type regedit in the Open box, and then click OK .
    b.  Locate and then select the following registry subkey: HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Options
    c.  On the Edit menu, point to New , and then click Dword Value .
    d.  Type NetworkAvailableTimeInSeconds , and then press Enter.
    e.  Right-click NetworkAvailableTimeInSeconds , and then click Modify .
    f.  In the Value data box, click Decimal , type a number value, and then click OK .
    Note This registry subkey sets the time, in seconds, that Excel waits for the network to resume. For example, if you type 15 for the number value, Excel waits 15 seconds for the network to resume. You might have to do some tests in your own environment to
    determine an appropriate value. You may have to try multiple numbers.
    g.  Locate and then select the following registry subkey.
    HKEY_CURRENT_USER\Software\Microsoft\office\14.0\common\Internet
    h.  Repeat step 2C through step 2F again. Reuse the same value that you used previously.
    i.  Exit Registry Editor.
    Feel free to post back. Thanks.
    Cheers,
    Tony Chen
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please contact
    [email protected]

  • How to get the FILE COUNT from File directory

    Hello,
    i have to develop a scenario like, get  the file count from source file directory and validate whether the file count is 5 or not. if 5 files exist i need to process those 5 files to DB tables. if file count is not equal to 5 then i need to send a mail to customer that files are missed at source directory. (subject as files were missed at source directory and in content i need to display the file names exist at source file directory. So that missed file will be generated by the customer based on this mail).
    Could you please let me know how to get the count of files from source file directory. if it is possible only with UDF please provide the Java code
    Best Regards,
    SARAN

    Do these files have some fixed names?
    Can you try to use the option Advanced Selection For Source File to make XI  pick all 5 files in one shot?
    Check this blog on the same -
    /people/mickael.huchet/blog/2006/09/18/xipi-how-to-exclude-files-in-a-sender-file-adapter
    If this is not a option - BPM sounds the only possible way.
    Regards,
    Bhavesh

  • The iphone .... cannot be synced.The file name was invalid or too long.

    the iphone .... cannot be synced.The file name was invalid or too long.
    wat can i do to sync my iphone

    Hi there rohitnitin,
    It looks like the article below addresses the error message you are describing.
    iTunes: Unable to sync photos
    http://support.apple.com/kb/TS3697
    -Griff W.

  • "The file name was invalid or too long" appears when I try to copy music form a CD to my computer using Windoww XP

    "The file name was invalid or too long" appears when I try to copy music from a CD to my compu
    ter using Windows XP

    Go to the songs view sorted as Album by Artist. Select, for example, the songs of artists whose names begin A-E. Right-click and click consolidate files. Assuming this group consolidate without error move on to another group, say F-J. If there is an error divide the original group into smaller chunks until you can isolate which tracks are causing a problem.
    tt2

Maybe you are looking for

  • Windows Vista and Airport Extreme USB Disc

    While I'm thrilled with my multiple Macs and their effortless ability to connect to my printers and USB hard drive on my Airport Extreme, my wife's new Windows Vista confuser isn't quite as seamless. When I try to connect to my hard drive using Windo

  • Problem in Logon to Shop Admin in CRM 5.0

    Dear All, Need some urgent help. We are on CRM ISA MSA 5.0 & on HP-UX 11.11. We are facing a problem in our CRM box due to which we are unable to proceed further. We have our CRM IST box (CRI) in which we need to configure the shop admin. In our CRM

  • Rounding of sales tax at header level

    HI I want to roundoff tax at header level . we already using the tax rounding off at item level . But new requirement is instead of Item level roundoff , they want the roundoff at header level Plz provide solutions

  • Cash vouchers

    Hi all experts, I have received object to develop cash vouchers in FI module objects should develop in smartform are as follows... [1] Petty Cash Voucher [2] Purchase Voucher [3] Journal Voucher [4] Expense Voucher I have no idea about FI module and

  • SSRS Data Driven Subscription Done: 9 processed of 9 total; 9 errors.

    Getting this error when running a data driven subscription on SQL Server 2008R2, Server is Windows Server 2008R2. Looked at the following. Report takes no parameters and I can view it/export it just fine from the report server website. I can run the