Count files that start with a certain letter

I need a simple script to give me a count of the files in a certain folder that start with "A" or some other character that I might choose.
I tried this but got an error
count every file name starts with "A" of folder ProofsOutFolder
Thanks for the help.

You can also approach it this way...
<pre style="width:630px;height:auto;overflow-x:auto;overflow-y:hidden;"
title="Copy this code and paste it into your Script Editor application.">set theFolder to choose folder
set theChar to text returned of ¬
(display dialog "Enter Search Character:" default answer "A")
do shell script "find " & quoted form of POSIX path of theFolder & ¬
" -type f -name '" & theChar & "*'|awk 'END{print NR}'"</pre>
Just another option to try out.

Similar Messages

  • What are the weird files that start with ._ that pc users get when I send zips?

    When I send files that I zip using Stuiffit to pc users they get the files plus an equal number of files that start with ._ Does anybody know what these are and how to get rid of them?
    Thanks!
    Karen

    Dot files are invisible files that OS X uses to display positions of files and folders icon for instance when you open a folder.
    That is indeed what a .DS_Store file does, but that's not the ones Bogies is referring to.
    There are various other items that start with a period, such as .Trashes. Every drive gets a trash folder, just as Windows does to each of its drives. While it hides its own trash folders from view, Windows doesn't recognize OS X's version of the trash folder, so you see it.
    But you're likely talking about these. Every file you copy from OS X to a DOS/Windows formatted drive gets a ._ file. The Mac OS has a twin file system; the data fork, and the resource fork. Windows has only a data fork.
    In order for OS X to maintain the resource fork data on a Windows drive, it has to write the resource data as a separate data fork file. So a file named foo.tif will also get a ._foo.tif file on the drive. Mac users don't see them since UNIX automatically hides anything that starts with a period. When you copy the file back to OS X, the data and resource fork info is combined again into a normal Mac file.
    Most of the time, removing these are no big deal. They hold simple data like Type and Creator codes, modification dates, icons, etc. Others, like Mac Type 1 PostScript or Mac legacy TrueType fonts have all of the font data in the resource fork. Delete the ._ files for those types of fonts, and you're left with nothing.

  • Whenever I start to sign in (MSN Hotmail), previous addresses come up that start with the same letter as mine. I would like to clear them out so that only mine comes up

    Problem summary: Whenever I start to sign in (MSN Hotmail), previous addresses come up that start with the same letter as mine. I would like to clear them out so that only mine comes up.
    In a different help forum someone told me that the autocomplete (autofill) feature of my browser is enabled. Seems that it is set to save autocomplete data for forms and/or usernames/passwords. I need help with the steps necessary to disable this feature.

    Problem summary: Whenever I start to sign in (MSN Hotmail), previous addresses come up that start with the same letter as mine. I would like to clear them out so that only mine comes up.
    In a different help forum someone told me that the autocomplete (autofill) feature of my browser is enabled. Seems that it is set to save autocomplete data for forms and/or usernames/passwords. I need help with the steps necessary to disable this feature.

  • Search for all words in a table column that any of the words start with a certain letter

    I have products table. Each row has a Description which may have a few words within it. I wanted to know if it's possible to search through it and find all descriptions that have match the search. But, I want it to consider it a match even if it's not the
    first word of the description, but rather the start of any word in the description.
    For example:
    Descriptions
    Nice Casual Gloves(This should show up, and although it's not in the very beginning of the description it's at the beginning of a new word.)
    Nice Dressy Gloves(This should show up, and although it's not in the very beginning of the description it's at the beginning of a new word.)
    Great Dresses (This should show up)
    Fancy Outerwear
    Glasses (This should show up)
    Shoes
    Sheer Stockings (This should not show up because although it has a "g" it's not in the beginning of a word.)
    Boots
    Galoshes (This should show up)
    I would want to search within this list Where Description like 'G%' but I don't want it to only get the descriptions that start with "g" at the beginning of the description, but rather any "g" at the beginning of any word. I do not want
    to get all descriptions that have a "g" somewhere in the word (then I could just do WHERE DESCRIPTION LIKE '%g%'), rather only if it somewhere within the description but at the beginning of any word.
    Thank you so much
    Debra has a question

    The most perfect solution would be to get a CLR routine to either (a) Do a regular expression match, (b) Run a split routine at CLR speeds then do a simple LIKE, or (c) both (a) and (b).  If your requirements grow to handle more and more complex searches,
    you may have to do it that way eventually.
    However, like the other answers, here's a way to do it reasonably well given your current requirements.  You may have to tweak the REPLACE logic if you have frequent OTHER forms of word delimiters.
    Method:  Pull data; add space before and after original text; replace all common word separators other than space with a space (so for example, "(These pretzels)", "He said 'These pretzels are making me thirsty" and so forth would
    be replaced with a space before "The"; then do a Patindex (you could do with just a LIKE also) on the search string prefaced with a space.  Here's an example, stealing from table sys.messages just for ease of demonstration.
    With SampleData as
    Select top 100 *
    , ' ' + Replace(Replace(Replace(Replace(text, '"', ' '), '''', ' '), '/', ' '), '(', ' ') + ' ' as TextPlus
    from sys.messages
    where language_id = 1033
    Select TextPlus
    , patindex('% The%', textplus)
    from SampleData
    where patindex('% The%', textplus) > 1
    Same logic, in the most concise format:
    Select top 100 Text
    from sys.messages
    where language_id = 1033
    and ' ' + Replace(Replace(Replace(Replace(text, '"', ' '), '''', ' '), '/', ' '), '(', ' ') + ' ' like '% the%'

  • Needing script to move files with name that starts with

    Here is part of the script that takes a excel file for the list to duplicate files from one folder the another. I would like it to use file name starts with instead exact file name. If I can get this to work I will not have to have a try for .jpg and a seperate try for .eps
                tell application "Finder"
                    try
                        duplicate (sourceFolder & theItem & ".jpg" as string) to destFolder with replacing
                    on error
                        do shell script "echo " & theItem & ">> $HOME/Desktop/NotFound.txt"
                    end try
                    try
                        duplicate (sourceFolder & theItem & ".eps" as string) to destFolder with replacing
                    on error
                        do shell script "echo " & theItem & ">> $HOME/Desktop/NotFound.txt"
                    end try
                end tell
    Thanks

    Ok here is the script that I've been using for a couple of years now with no problems, until I upgraded. Don't know what happened, because I cant even use it on a older system that we have. The error I get is when it tries to get the value of selection from Excel. It times out with no values. Thanks for any help!
    set sourceFolder to choose folder with prompt "Select the folder that contains images to move."
    set destFolder to choose folder with prompt "Select the destination folder"
    if sourceFolder is not destFolder then my moveImageFiles(sourceFolder as string, destFolder)
    on moveImageFiles(sFolder, dFolder)
        script o
            property valuesList : {}
        end script
       tell application "Microsoft Excel" to set o's valuesList to value of the selection
        if class of o's valuesList is not list then return -- not multiple selection
        set tc to (count o's valuesList)
        set dFolder to quoted form of POSIX path of dFolder
        set errorFile to quoted form of POSIX path of (sFolder & "filesNotFound or NotMoved.txt")
        do shell script "/bin/rm " & errorFile & " > /dev/null 2>&1 &" -- remove the error file (if it exists)
        repeat with i from 1 to tc
            repeat with thisValue in (get item i of o's valuesList)
                if contents of thisValue is not "" then -- not a blank cell
                    set tFile to quoted form of POSIX path of (sFolder & thisValue)
                    try
                        do shell script "shopt -s nocaseglob; /bin/mv -f " & tFile & "* " & dFolder
                    end try
                end if
            end repeat
        end repeat   
        do shell script "/usr/bin/open -b com.apple.textedit " & errorFile & " > /dev/null 2>&1 &"
    end moveImageFiles

  • I am using Firefox 11 and I am unable to print web pages. I can print PDFs ok. I tried to open the prefs.js file to delete anything that starts with print and I get an error message.

    I cannot print web pages. I've tried the solutions suggested like deleting anything that starts with print in the prefs.js file but I get an error message: Script: c:\users\rick\appdata\roading\mozilla\firefox\profiles\iviwh5c1.default\prefs.js
    line: 1
    Char: 1
    Error: invalid character
    code: 800A03F6
    Source: Microsoft JScript compilation error

    When editing '''prefs.js''' you need to use a simple text editor program. WinXP Notepad messes up the line formatting of prefs.js, so I use Wordpad - but you need to save the edited file in a Text-Only format (Wordpad asks about that when you go to save the edited file). I never used Win7, so I don't know if that version of Notepad messes with the line formatting of prefs.js or not.
    Another thing - make sure '''''"Hide extensions for known file types"''''' is de-delected in Windows file / folder options > view -> advanced settings. Otherwise Windows may add a .txt file extension that you won't be able to see, and that will break that file in Firefox. '''prefs.js.txt''' won't be recognized by Firefox, when is expecting to find '''''prefs.js''''' .

  • How can i set up mac mail so each line starts with a capital letter?

    how can i set up mac mail so each line starts with a capital letter? 

    I am pretty sure that this is not an option within Apple Mail.

  • How to access a JSON structure key that starts with a number

    I've got an odd issue here.  I'm accessing someone else's JSON structure so I am not able to change it.  The JSON structure keys are named with both characters and numbers like this:
    0
    198456
    product_id
    198456
    1
    Rashaan Houston feat Tony Loreto
    artist
    Rashaan Houston feat Tony Loreto
    So, in other words, there's a key named "0" and a key named "product_id", both of which contain the same key.  Why they did that, I don't know, but they did.
    In one of the instances, the data stored under the text-named key isn't the same as the numerical-named key.  I tried to output the data in the numerical key like this (it's an array of structures):
    #strStompyJSON.data[1].0#
    but I get the following error:
    Invalid CFML construct found on line 41 at column 31.
    ColdFusion was looking at the following text:
    .0
    When I do the following, it works fine:
    #strStompyJSON.data[1].product_id#
    So it looks as though CF doesn't like accessing a variable that starts with a number.  I am able to loop through the structure using a collection loop, and it outputs all of the keys (including the numerical ones) and their values using the following code:
    <cfloop collection="#strStompyJSON.data[1]#" item="key">
    #key#: #strStompyJSON.data[1][key]#<br />
    </cfloop>
    However, that doesn't allow me a way to access specific keys named with a number.  Is there a way that I can specifically access a key that is named with a number?
    thanks!
    Mike

    No problem--glad it worked out.
    As a follow-up to this, I'd encourage you to keep the bracket notation in mind during future development.  It is EXTREMELY useful in a lot of situations.
    For example, if you're building a structure on the fly with dynamic keys, bracket notation is extremely helpful:
         <cfset authors = structnew()>
         <cfloop list="authorlist" index="name">
              <cfset authors[name] = getbooklist(name)>
         </cfloop>
    Also, bracket notation is really nice when creating json from ColdFusion structures.  Consider this:
         <cfset author = structnew()>
         <cfset author.name = "Neil Gaiman">
         <cfset author.genre = "Fantasy">
         <cfset author.awesome = true>
         <cfset authorjson = serializejson(author)>
    By default, the serialized json produced will have all UPPER CASE keys.  Not a big deal in most cases, but if you're returning the json to something (like a JS library) that is expecting keys in a certain case, it can be a problem.  Fortunately, bracket notation allows you to specify exactly what case you want the structure's keys to be in:
         <cfset author = structnew()>
         <cfset author['name'] = "Neil Gaiman">
         <cfset author['Genre'] = "Fantasy">
         <cfset author['AWESOME'] = true>
         <cfset authorjson = serializejson(author)>

  • Possible bug in iTunes 8 adding folders that start with '..'

    So I discovered tonight when trying to load tracks into iTunes from a folder that started with '...' (specifically, '...andjustice_forall'). iTunes did nothing. No reaction whatsoever. If I try to load the mp3s in that folder directly, they load fine, but it ignores the whole folder if I try to add it to the library.
    I tried to replicate the issue with another folder that also started with '...' ('...andyou_will_know_us_by_the_trail_ofdead'). Has anyone else observed this behaviour? I have a feeling if it's in iTunes 8, it's been around for a while. I'm guessing it's treating the first dot as an indication that the file's a hidden file, and then ignoring the rest of the name.
    Can anyone else replicate this? I was loading files from an SMB share served by a Linux host.
    cheers,
    Klaus

    I just sent feedback as suggested, hope this helps. What bothers me is that these songs were visible in previous versions of ITunes. I'd actually feel better if there were a setting I just missed that would explain the weird behavior.
    Looking through support topics, I specifically did a search using ".38 Special" and found an article concerning the order in which Itunes displays artists, with .38 Special being at the top of the list in the example... so that also tells me that it SHOULD be showing them. sigh

  • Im am trying to send the reset information for my apple security question to my email, they are not be received and it says it is sending it to a email that starts with c

    Im am trying to send the reset information for my apple security question to my email, they are not be received and it says it is sending it to a email that starts with c

    That's not a good sign if it said it was going to send it to an email address you've never heard of. Contact iTunes Support and let them know this: http://apple.com/support/itunes/contact/

  • I have a column of names, some DO NOT start with a capital letter, how do I filter them

    new to Mac environment and i have a column of names, some DO NOT start with a capital letter, how do I filter them

    HI PTU,
    You can mark the rows starting with lower case letters using a formula, then filter on the contents of the column containing the formula. For the example below, the names are in column B and the formula is in column C.
    C2: =IF(AND(CODE(B)>=95,CODE(B)<=122),"!!!","")
    CODE returns the ASCII code for the first character in the target cell. Lower case letters have ASCII codes in the range specified in the formula: a = 95, z = 122
    For names starting with characters in this range, the forula returns a string of three exclamation points. For any other initial character, the formula returns a null string ( "" ).
    An empty cell in column B will cause the formula to return an error in that row of column C. You can avoid this by embedding the formula in an IF statement that suppresses the calculation if the length of the entry in column B is less than one character. Revised formula shown below.
    C2: =IF(LEN(B)<1,"",IF(AND(CODE(B)>=95,CODE(B)<=122),"!!!",""))
    Regards,
    Barry

  • How do I get rid of bad email that starts with info @ they jam if opened

    Anybody know how to get rid of bad email that starts with info @ in the address bar? They jam the mail program if opened, now I have 25 that need to go! Help?

    You only need to post once. You have to have some patience. I posted this response in your other question as well.
    Don't open those emails, swipe across them in the preview window to bring up the red delete button and use that.
    If the mail app is frozen and you can't do anything in it, close it from the recents tray and reboot the iPad.
    From your home screen, double tap the home button and the recents tray will appear with all of your recent apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the mail app icon. Tap the home button or anywhere above the task bar.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

  • Can't open7z file that cam with cs5 upgrade

    Unable to open a 7z read me file that cam with Photoshop cs5 upgrade.?

    There were two files.  A small EXE and the larger 7z file.  You need the EXE file that accompanies the 7z file to start the decompression of the 7z file.

  • When typing an email I need each new sentence to automaticaaly start with a capital letter. At present after a full stop the new sentence automatically starts with a lower case letternot an upper case one

    When typing an email new sentences do not automatically start with a capital letter after a full stop.
    Surely this should happen automatically without the need for me to touch the capital letter icon.
    peter

    peterlesliebabani wrote:
    i called apple and the guy i spoke to said it is probably a VIRUS and it will be corrected on the next update!
    Either you didn't actually call Apple, and got some tech support scammer instead (calling the first number that pops up on a Google search for "Apple support" can give you some bad numbers), or the Apple tech you spoke to didn't know what he's talking about. It's not a virus.
    As for the problem, if you have enabled auto-capitalization and the problem continues, first try resetting your device. Press and hold both the home button and the sleep/wake button for about 10 seconds, until the screen turns off. Ignore the slider that will appear. Release the buttons, then press and hold the sleep/wake button until the Apple logo appears. This is the equivalent of a reboot, and should not affect your data or apps.
    If that doesn't help, try restoring your device from backups, and if that doesn't help, restore it to factory settings (ie, do not restore a backup). See:
    http://support.apple.com/kb/ht1414
    If none of that helps, the issue is caused by some kind of hardware problem, and the device will need to be repaired or (more likely) replaced.

  • PeopleSoft queries that start with QA_TL

    We are in the process of upgrading from Peoplesoft HCM 8.8 to PeopleSoft HCM 9.0. Part of this process involves cleaning up old queries. We noticed that there are a lot of delivered pubblic queries that start with QA_TL that we have not used in at least 5 years. Does anyone out there know what these queries are and what the prefix QA_TL stands for?

    when u work for an XYZ company... developers under XYZ name their queries as XYZ_module name generally.
    QA_TL can be related as QA as company name, TL stands for time and labour under workforce management for HCM application.
    if QA is not ur company name , may be while testing under 8.8 they termed the query to QA query.
    coming onto queries , without looking at the queries it is impossible to say what that query does.
    from your statement as everything is a public query , u can run them and see the output in excel , what it does exactly.
    under PIA -- reporting tools -- query manager ... do a search
    with each query name there is some description written next to it.
    if the end user requests saying "he needs certain data to be populated out", developer writes a query and add security to it. under time labour generally queries are activity by vendor group, activity by batches, Dept Mg detail ... things like that.
    Thnks!

Maybe you are looking for