How to count number of files in a folder?

The folder "_Current Assets" has 16 .wav files and nothing else. I'd like Applescript to get this number.
Below, the code that changed between trials is in bold
*Code tried:*
_Trial 1:_
set theFolder to "Macintosh HD:Users:dannykalman:Desktop:_Current Assets"
set numberOfAudioFiles to count of files in theFolder
display dialog numberOfAudioFiles
dialog says: 0
_Trial 2:_
set theFolder to "Macintosh HD:Users:dannykalman:Desktop:_Current Assets"
set numberOfAudioFiles to count of items in theFolder
display dialog numberOfAudioFiles
dialog says: 56
_Trial 3:_
set theFolder to "Macintosh HD:Users:mr:Desktop:_Current Assets"
set numberOfAudioFiles to count of *(files whose kind is "WAVE Audio File")* in theFolder
display dialog numberOfAudioFiles
dialog says: Can’t get every file of "Macintosh HD:Users:dannykalman:Desktop:_Current Assets".
I'm out of ideas : (. What would you suggest?
Thank you so much!

It worked because the path is in the correct syntax. BTW, the count is correct without the -1. Every folder that's been opened has a hidden .DS_Store file (which gets counted) that contains all of its properties, such as view, size, and location. Use the -1 if you want to suppress that file; however, it will count any other hidden ones. For AppleScript queries, use this forum. I had the Hosts move this post to it.

Similar Messages

  • How to find number of files in a folder using pl/sql

    please someone guide as to how to find number of files in a folder using pl/sql
    Regards

    The Java option works well.
    -- results table that will contain a file list result
    create global temporary table directory_list
            directory       varchar2(1000),
            filename        varchar2(1000)
    on commit preserve rows
    -- allowing public access to this temp table
    grant select, update, insert, delete on directory_list to public;
    create or replace public synonym directory_list for directory_list;
    -- creating the java proc that does the file listing
    create or replace and compile java source named "ListFiles" as
    import java.io.*;
    import java.sql.*;
    public class ListFiles
            public static void getList(String directory, String filter)
            throws SQLException
                    File path = new File( directory );
                    final String ExpressionFilter =  filter;
                    FilenameFilter fileFilter = new FilenameFilter() {
                            public boolean accept(File dir, String name) {
                                    if(name.equalsIgnoreCase(ExpressionFilter))
                                            return true;
                                    if(name.matches("." + ExpressionFilter))
                                            return true;
                                    return false;
                    String[] list = path.list(fileFilter);
                    String element;
                    for(int i = 0; i < list.length; i++)
                            element = list;
    #sql {
    insert
    into directory_list
    ( directory, filename )
    values
    ( :directory, :element )
    -- creating the PL/SQL wrapper for the java proc
    create or replace procedure ListFiles( cDirectory in varchar2, cFilter in varchar2 )
    as language java
    name 'ListFiles.getList( java.lang.String, java.lang.String )';
    -- punching a hole in the Java VM that allows access to the server's file
    -- systems from inside the Oracle JVM (these also allows executing command
    -- line and external programs)
    -- NOTE: this hole MUST be secured using proper Oracle security (e.g. AUTHID
    -- DEFINER PL/SQL code that is trusted)
    declare
    SCHEMA varchar2(30) := USER;
    begin
    dbms_java.grant_permission(
    SCHEMA,
    'SYS:java.io.FilePermission',
    '<<ALL FILES>>',
    'execute, read, write, delete'
    dbms_java.grant_permission(
    SCHEMA,
    'SYS:java.lang.RuntimePermission',
    'writeFileDescriptor',
    dbms_java.grant_permission(
    SCHEMA,
    'SYS:java.lang.RuntimePermission',
    'readFileDescriptor',
    commit;
    end;
    To use:
    SQL> exec ListFiles('/tmp', '*.log' );
    PL/SQL procedure successfully completed.
    SQL> select * from directory_list;
    DIRECTORY FILENAME
    /tmp X11_newfonts.log
    /tmp ipv6agt.crashlog
    /tmp dtappint.log
    /tmp Core.sd-log
    /tmp core_intg.sd-log
    /tmp da.sd-log
    /tmp dhcpclient.log
    /tmp oracle8.sd-log
    /tmp cc.sd-log
    /tmp oms.log
    /tmp OmniBack.sd-log
    /tmp DPISInstall.sd-log
    12 rows selected.
    SQL>

  • How to count number of files on zfs filesystem

    Hi all,
    Is there a way to count the number of files on a zfs filesystem similar to how "df -o i /ufs_filesystm" works? I am looking for a way to do this without using find as I suspect there are millions of files on a zfs filesystem that is causing slow performance sometimes on a particular zfs file system
    Thanks.

    So I have finished 90% of my testing and I have accepted _df -t /filesystem | awk ' { if ( NR==1) F=$(NF-1) ; if ( NR==2) print $(NF-1) - F }'_ as acceptable in the absence of a known built in zfs method. My main conern was with the reduction of available files from the df -t output as more files were added. I used a one liner for loop to just create empty files to conserve on space used up so I would have a better chance of seeing what happens if the available files reached 0.
    root@fj-sol11:/zfstest/dir4# df -t /zfstest | awk ' { if ( NR==1) F=$(NF-1) ; if ( NR==2) print $(NF-1) - F }'
    _5133680_
    root@fj-sol11:/zfstest/dir4# df -t /zfstest
    /zfstest (pool1 ): 7237508 blocks *7237508* files
    total: 10257408 blocks 12372310 files
    root@fj-sol11:/zfstest/dir4#
    root@fj-sol11:/zfstest/dir7# df -t /zfstest | awk ' { if ( NR==1) F=$(NF-1) ; if ( NR==2) print $(NF-1) - F }'
    _6742772_
    root@fj-sol11:/zfstest/dir7# df -t /zfstest
    /zfstest (pool1 ): 6619533 blocks *6619533* files
    total: 10257408 blocks 13362305 files
    root@fj-sol11:/zfstest/dir7# df -t /zfstest | awk ' { if ( NR==1) F=$(NF-1) ; if ( NR==2) print $(NF-1) - F }'
    _7271716_
    root@fj-sol11:/zfstest/dir7# df -t /zfstest
    /zfstest (pool1 ): 6445809 blocks *6445809* files
    total: 10257408 blocks 13717010 files
    root@fj-sol11:/zfstest# df -t /zfstest | awk ' { if ( NR==1) F=$(NF-1) ; if ( NR==2) print $(NF-1) - F }'
    _12359601_
    root@fj-sol11:/zfstest# df -t /zfstest
    /zfstest (pool1 ): 4494264 blocks *4494264* files
    total: 10257408 blocks 16853865 files
    I noticed the total files kept increasing and the creation of 4 millions files (4494264) after the above example was taking up more time than I had after already creating 12 million plus ( _12359601_ ) which took 2 days on a slow machine on and off (mostly on). If anyone has any idea of creating them quicker than "touch filename$loop" in a for loop let me know :)
    In the end I decided to use a really small file system 100mb on a virtual machine to test what happens as the free files approached 0. Turns out if never does ... it somehow increased
    bash-3.00# df -t /smalltest/
    /smalltest (smalltest ): 31451 blocks *31451* files
    total: 112640 blocks 278542 files
    bash-3.00# pwd
    /smalltest
    bash-3.00# mkdir dir4
    bash-3.00# cd dir4
    bash-3.00# for arg in {1..47084}; do touch file$arg; done <--- I created 47084 files here, more that the free listed above ( *31451* )
    bash-3.00# zfs list smalltest
    NAME USED AVAIL REFER MOUNTPOINT
    smalltest 47.3M 7.67M 46.9M /smalltest
    bash-3.00# df -t /smalltest/
    /smalltest (smalltest ): 15710 blocks *15710* files
    total: 112640 blocks 309887 files
    bash-3.00#
    The other 10% of my testing will be to see what happens when I try to a find on 12 million plus files and try to pipe it to wc -l :)

  • How to count number of sales orders generated in a month in SAP SD

    Hi SD Gurus,
    I have a very strange query from client. I have to count the number of sales order created in a month for a z report. For example 30 in Jan, 25 in Feb etc. Could anyone suggest me How to count number of sales orders generated in a month in SAP SD.
    Regards
    Vinod Kumar

    Hi,
    Goto the T.Code "SE16" or "SE16n" or "SE11".
    Enter the table name as VBAK
    Enter the created on date as the starting date of the period and to date as the end date.
    Enter.
    Click on "Number of Entries".It will tell you the number of entries created in a particular period.
    If you want a report,goto the T.Code "VA05n".
    Regards,
    Krishna.

  • How to Count Number of completed line items in past 6 months / 12 months ?

    How to Count Number of completed line items in past 6 months / 12 months ?
    Hi,
    I am trying to count "Number of Completed Line Items in Purchase Order Document" for my Key Figure ZPO_CNT.
    Purchase Order document = ZEBELN
    Line Item = ZEBELP.
    I need to find and count if the Line Item has been received in the past 6 months from today and similarly in the past 12 months.
    I have "Delivery Completed" field, ELIKZ.
    So, based on this would I be able to calculate it in Query Designer?
    If so, Please let me know how

    Hello Deva
    If youe want to calculate the completed line item for last 6 or 12 month then i think u will be displaying the query data for these montrhs...create a customer exit to give you date range and restric it in filter area....
    Now Choose any of the below option
    1. I would suggest to implement an additional key figure "counter" in cube and fill values with one for which delivery is completed.
    Now use calculated key figure in Query Designer based on logic
    IF counter = 1 THEN counter ELSE 0
    OR
    2. create a formula variable based on ELIKZ and use replacement path variable, it will display you no. of docs for which delivery is completed....
    Award points if it solves your problem
    Revert back in case of further assistance...
    Thanks
    Tripple k

  • How to count number of ones in table

    Hello,
     i created one table 16x32 each cell is updating 1 byte of data,how to count number of one in all cell,and is it right way to calculate check sum??
    thank you

    The simplest way is to call GetTableCellRangeValues with VAL_ENTIRE_TABLE as the range, next summing array elements.
    But I don't understand your comment on checksum, so this may not be the more correct method for your actual needs: can you explain what do you mean?
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to count number of rows in table

    can I get number of row in table except Count(*) in pl/sql
    is there any other way

    Also posted and answered here
    how to count number of rows in table
    count(*) will be the fastest way. It is only slow if the table has a vast number of rows, in which case why do you need to know the tables has 73552436467721 rows and not 73552436467737 rows. It doesn't seem to be much use. Either that or you are counting them a lot, which again seems rather pointless.

  • How to count number of online user

    i am developing bid application using servlet/jsp. how to count number of online user ple help me.

    hi,
    may be the following code help you...
    import javax.servlet.http.HttpSessionListener;
    import javax.servlet.http.HttpSessionEvent;
    public class ActiveUserCount implements HttpSessionListener {
         private static int activeUsers = 0;
         public void sessionCreated(HttpSessionEvent se) {
              activeUsers++;
         public void sessionDestroyed(HttpSessionEvent se) {
              if(activeUsers > 0)
                   activeUsers--;
         public static int getActiveUsers() {
              return activeUsers;
    }Dhaval

  • Please let me know how to Count Number of completed line items in past 6 mo

    How to Count Number of completed line items in past 6 months / 12 months ?
    Hi,
    I am trying to count "Number of Completed Line Items in Purchase Order Document" for my Key Figure ZPO_CNT.
    Purchase Order document = ZEBELN
    Line Item = ZEBELP.
    I need to find and count if the Line Item has been received in the past 6 months from today and similarly in the past 12 months.
    I have "Delivery Completed" field, ELIKZ.
    So, based on this would I be able to calculate it in Query Designer?
    If so, Please let me know how
    Krishna

    Hi Experts,
    I dont have a defined Restricted key figure yet.
    I have populated 0COMPL_DEL(Delivery Completed Indicator)  and 0EBELN (Purchasing Document Number) and 0EBELP (Line Item Number in Purchasing Document) .
    This is what I think how I need to calculate:
    Number of completed line items in past 6 months:
    If  Delilvery Completed Indicator (0COMPL_DEL) = x, calculate No. of Line Items (ZPO_CNT) from 0CALDAY to 6 months
    and
    Number of completed line items in past 12 months:
    If  Delilvery Completed Indicator (0COMPL_DEL) = x, calculate No. of Line Items (ZPO_CNT) from 0CALDAY to 12 months
    Please let me know if the logic is correct. If so, how I can create this in report

  • Counting number of files in ID

    Hello Experts,
                       I have a scenario where a job runs weekly and creates 6 files on one of the prod folders in a legacy system. The files are FTPd to PI. Before picking the files we need to ensure that the count for the files on that folder is 6. If it is 6 or greater then we can pick all those 6 files and send it across to PI (also with archiving it on another folder structure in the legacy system) where PI will send it to another system. If the count is less than 6, then we do not need to do any thing. If count 6 is reached and the files are picked, reset the counter to 0.
        So for this scenario do we need to use a BPM or we can manage with the "Run OS Command...." option??. If any of you have come across such a scenario, then pls let me know the solution. Current version of PI is 7.1 .
         Points to best answer/solution will be given.
    Thanks.

    Hi, This is just sample script you can reference:
    Script_1:
    Dim objFileScripting, objFolder
    Dim filename, filecollection, currentFolder,counter
    currentFolder = ActiveDocument.Path
    On Error Resume Next
    Set objFileScripting = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFileScripting.GetFolder(currentFolder)
    Set filecollection = objFolder.Files
            For Each filename In filecollection
              counter = counter+1      
            Next
    if counter = 6 then
            For Each filename In filecollection
              objFileScripting.CopyFile filename,"..\Folder_1\" & filename      
            Next
    else
          call sendmail("mailaddress", "Title Here","Content Here")  
    endif
    set  objFileScripting = nothing
         set objFolder = nothing
         set filecollection = nothing  
    'This function is used to send out email notification, the usage are like:
    'call sendmail("mailaddress", "Title Here","Content Here")
    Function sendmail (recipient, title,  message)
    Dim oLapp
    Dim oItem
    Set oLapp = CreateObject("Outlook.application" )
    Set oItem = oLapp.CreateItem(0)
    With oItem
    .To = recipient
    .Subject = title
    .Body = message
    End With
    oItem.Send
    Set oLapp = Nothing
    Set oItem = Nothing
    end function
    Script_2: scheduler
    Dim ws
    On Error Resume Next
    set ws = WScript.CreateObject("WScript.Shell")
    ws.Run ("script_1.vbs")
    while 1 = 1   
       WScript.Sleep 1000*60*60       'sleep 1 hour, run your first script every 1 hour
       ws.Run ("script_1.vbs")
    Wend
    set ws = nothing
    Make sure in your source system, you have outlook mail setup there.
    Put the two scripts in folder_2, to check the number of files
    Regards.
    Liang
    Edited by: Liang Ji on Apr 4, 2009 4:14 AM

  • Maximum number of files in a folder ?

    Hello, what is the maximum number of files in a folder OS X can handle ?
    I used a file recovery software called FileSalvage to save some files of an external 300GB with a corrupted disk directory (unable to repair with the usual repair/recovery programs).
    FileSalvage recovered about 435,000 files and sorted them by extension in individual folders, unfortunately it does not recognize the file names and just sequentially names the files per extension.
    The .jpeg, .gif and .html folders had up to 75,000 files. After recovery the external FW drives started to behave very strange, unresponsive, just hanging, time-out. I tried on a Mac Mini, iMac G5, an iBook and PowerBook, OS X 10.3.9 and 10.4.3, FW400/800 and USB 2.0 interface, they all had pretty much the same failure mode after a while.
    Running Disk Utility on the drives with the recovered FileSalvage folders showed a corrupted directory (invalid file count) and unable to repair, although I could copy most of the folders of the disk (deleted the folders with more than 10,000 files per folder).
    I suspect that File Salvage copies more files in a folder than OS X allows, causing unpredicable problems.
    Any ideas ?

    From "Mac OS X: Mac OS Extended Format volume and file limits"
    "Maximum number of files (or files and folders) in a folder … up to 2.1 billion"
    According to a note in the document, the above is subject to the drive's size (maximum 16 terabytes in "Tiger") and block size, ie. the number of available blocks.
    So it would appear that the number of files you mentioned would be well within theoretical limits, although I suppose there could be a bug in some other part of OS X. Otherwise, maybe there is a problem with the drive...

  • How can I bring a file from a folder on my desktop to this program and make it editable. Like deleti

    How can I bring a file from a folder on my desk top int this program and make it editable., in order to replace words or remove words or texts..?  jn

    Hi,
    FormsCentral cannot be used to edit existing PDF documents. That functionality is available in Adobe Acrobat:
    http://www.adobe.com/products/acrobat.html
    Regards,
    Brian

  • Choose a set number of files in a folder?

    Is there a way using AppleScript to choose a set number of files inside a folder?
    I've created an Automator workflow to convert some files (Illustrator to PDF) but the folders contain a large number of files (nearly 500). If I ran the workflow on this amount of files I'm pretty sure it would crash, as the workflow opens the files & then saves them in the other format (so it would open all 500 files).
    So what the workflow does at the moment is ask me to choose the files to convert, I select around 50 & let it convert them & closes the files. It loops, so once it's completed them I it asks again to choose more files to convert etc...
    If I could make it choose a set number of files (via some AppleScript & add this to the workflow) it could open & convert (for example) 50 files, then open & convert the next files. And keep doing this until it completes converting all of them.

    red_menace wrote:
    What happens to the original item after the conversion? Is it moved, or will some method need to be used to keep track of what has already been converted?/Trim Input Items.action.zip
    After the files have been converted they are moved to another folder so that I don't choose them again & again, & so that I know they've been converted.
    So if I used the Trim Input Items action it would choose only 9 items, convert them & then (with the workflow looping) convert another 9 files, & so on & so on. Is that correct? If so that could work for me.
    The Dispense Items Incrementally action could also work for me. If I understand correctly it would convert 1 file at a time & I'd set to loop so it goes through all the items 1 at a time.
    Camelot wrote:
    I don't see the need to select a set number of files in the folder.
    From your description it sounds like you want to process them all anyway, it's just that your existing (manual-select) workflow works by selecting a few at a time.
    What's wrong with the script identifying all files and processing them all in one loop?
    Because my workflow (at the moment) opens all the files at once, & then converts them. So it would open nearly 500 Illustrator files in one go rather then opening a few of them, or opening them 1 at a time. I'm pretty sure it would choke my system opening up 500 files (not particularly small files either).

  • How can I upload multiple files or whole folder structures in one go to the Cloud?

    How can I upload multiple files or whole folder structures to the Cloud in one go? Uploading lots of files singularly does not help my workflow.
    All help is much appreciated.
    Paul.

    Hi,
    Uploading multiple files is browser specific.
    Internet explorer won't allow to select and upload multiple files on the cloud.
    If you want to upload multiple files then you have to login to Cretaive cloud using Firefox or Chrome web browser, then you can select multiple files in the Browse window to upload.
    You can't upload folders directly.
    Thanks,
    Baljeet

  • How to delete recorded asf file in Documents folder?

    How to delete recorded asf file in Documents folder?.
    I did a beehive recording which is saved in Documents folder as Administrator and the file is big 600MB for less than hour session recording. Also this 600MB is taken from my email quota.
    How to recorded with less file size?.
    thx
    Srini

    You can delete it using OBEO or by mapping a Webdav connection.
    Use the following link to map a Webdav connection.
    http://my.oracle.com/site/pdit/BusinessOpsIT/Collab/CustomerAdvocacy/Support/UserTrainingGuides/BeehiveUTG/TeamCollab/WebDAVNetworkPlace/index.html
    Moreover this is the Beehive Online forum, please post questions related to ST Beehive in its forum.
    http://myforums.oracle.com/jive3/forum.jspa?forumID=1886
    Thanks,
    Jereen

Maybe you are looking for