Finding Selected Files

I started a thread asking how I can find and delete selected files at http://discussions.apple.com/thread.jspa?messageID=6435289#6435289
I was advised to paste the following script into Apple's Script Editor...
tell application "Finder"
delete (every file of entire contents of folder "Sites" of home whose name is "Thumbs.db")
end tell
Unfortunately, it doesn't work. It just times out, my Finder freezes, and I have to manually restart my computer.
However, it does at least FIND every instance of the file I'm looking for. So I'd like to ask about a few variations of this script so I can understand how it works.
Suppose that instead of searching for every instance of Thumbs.db in the folder Sites I wanted to search for every instance of Thumbs.db in User/Sites/MySite. What script would I write to do that? What about searching for the file in User/Sites/MySite/includes ?
Also, what about searching for text on a page rather than a file name? For example, I would like to compile a list of every file in a website that includes a PHP database query. I think I could find all of these queries by searching for mysql_ in each web page's source code. So how could I search for every file that includes "mysql_" in User/Sites/MySite?
Thanks.

1. Use:
tell application "Finder"
delete (every file of entire contents of folder "Sites:MySite" of home whose name is "Thumbs.db")
end tell
2. This is best done with a tool such as TextWrangler instead of with AppleScript.
(28479)

Similar Messages

  • Under finder select file and under file print is not highlighted

    I select finder and then file but cannot select print under file menu because print is not in bold!

    It would be much more helpful if you provided a more complete description including the version of OS X installed on the computer. By complete what type of file is it, i.e. the file extension information.

  • Finding the directory of selected files

    I have selected files in the following manner
    set new_file to (choose file with prompt "Choose files to save as PDF files.:" with multiple selections allowed)
    What I now need the the path of the folder these files came from but am not having any luck with this. Thanks if anyone can help.

    You can ask Finder for any item's container, which in this case would be a folder:
    click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">set new_file to (choose file with prompt "Choose files to save as PDF files.:" with multiple selections allowed)
    tell application "Finder" to set new_folder to the container of first item of new_file</pre>

  • How to copy selected files in Finder (applescript)

    I don't like to use hotkeys (such as CMD+C, etc.) and would prefer to copy and paste files in OS X with the mouse just like I did in Windows.
    Unfortunately Finder has no such copy and paste buttons in its toolbar like I know them from Windows Explorer. It bothers me that I always have to use the context menu or hotkeys. So I intend to write small scripts with AppleScript and move them into the Finder toolbar to have my custom made buttons.
    Unfortunately I am newbie to Applescript and did not yet manage to get such simple script to work despite many trials.
    The first script must only copy marked/selected files or folders in Finder to the clipboard so that I can paste them into another Finder window.
    The second script should simply paste the clipboard content into Finder.
    I tried this but nothing is being copied:
    tell application "Finder"
    activate
    end tell
    tell application "System Events"
    key down {command}
    keystroke "c"
    key up {command}
    end tell
    Would be great if somebody can help me with these few lines.
    Thanks in advance

    meanwhile got a reply in another forum that works like charm exactly as I want...I post it here below for future newbies...
    tell application "Finder" activate
    delay 0.2
    tell application "System Events"
    tell process "Finder"
    keystroke "c" using command down
    end tell
    end tell
    end tell
    save as program and then drag to Finder toolbar.
    You can even change the icon.
    Thanks for your attention guys

  • Finder de-selects files when they are locked/unlocked

    I have several encrypted disk images that I use to store various personal info on:  financial data, logins/passwords, health info, etc.
    Whenever I update the content on any of them I make a copy of the .dmg file, then rename the copy with the date and time in the filename.  For example, if I have a test.dmg file, when I update content in it, I would make a copy and rename the copy like test_201401051459.dmg.  That way I have a series of backups of each iteration of the encrypted disk image file.  (I've had encrypted disk image files get corrupted in the past, so this is a simple way to make sure I can open at least one of the previous backup files if necessary.)  I also "lock" each dated copy of the .dmg file to prevent accidental deletion.
    At the end of each month I move all of the dated backup .dmg files to an "_Old Data" folder.  In order to do that, I select all the .dmg files I want to move into the subfolder, then right-click (or ctrl-click) on them and -- continuing to hold the Ctrl key down -- I click on "Get Summary Info" to open a single "Get Info" dialog for all of the files so I can unlock them before I move them (if I don't unlock them, then Finder will make copies instead of moving them).  As soon as I de-select/uncheck the "Locked" option in the "Multiple Item Info" dialog, Finder de-selects all of the selected files in the Finder window and also narrows the column they're displayed in (I always use Column View in Finder windows).  This forces me to manually re-widen the column so I can see the entire file names, and manually re-select all of the files so I can move them into the sub-folder.
    This is changed behavior from Snow Leopard (from which I upgraded to Yosemite).  In Snow Leopard, Finder left things alone.  It didn't decide all on its own that files should be de-selected and that column widths should be narrowed to what it thinks is right.  This turns a relatively simple operation into an unnecessarily-more-complex operation.  Pure PITA.
    Mid-2011 iMac
    <Edited by Host>

    Hi Dan,
    The issue occurs on specific file type or all files have the same issue?
    We have an FAQ thread which could help troubleshooting network slowness issue. Please see if it could help:
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/7bd9978c-69b4-42bf-90cd-fc7541ccb663/forum-faq-troubleshooting-network-file-copy-slowness?forum=winserverPN
    If you have any feedback on our support, please send to [email protected]

  • Finder jumping to previously selected file - iMac 10.6.8

    I am having the frustrating problem on my IMac running 10.6.8 that the finder is jumping to previously selected file whenever I expand a new folder. So, if I select file A in Folder A, then scroll down and expand Folder B, the Finder automatically jumps back up to file A at the top of the screen. Sometimes I don't even have to open a new folder, if I just scroll down the list of files/folders, it will sometimes jump back up to the selected file. Is this a bug? A setting? It wastes a lot of time as I have to keep going back to where I was in the finder window...
    I have searched this on this forum and on Google and nobody seems to have any answers. I would hope that Apple would fix this bug in an update if it is indeed a bug, or, if it is a setting, where can I change it?
    Thanks for any help!

    The white iMacs from 2006 can only be upgraded as high as 10.7 which is Lion, not Mountain Lion. RAW files work fine on my 2006 white iMac with Lion so upgraded to 10.7 and then try out RAW images before you purchase a new machine. On a side note, I found the white iMacs quite slow (what with their age) and so I installed an SSD drive. Well worth the money! Impressively quick for an older machine.

  • Finding strings in "Selected Files in Site" not working

    When searching files for a string, and selecting "Selected Files in Site", Dreamweaver (starting today) will only search the root directory, NOT the selected subdirectory.  This is uselss.  I've been using Dreamweaver for years.  Today I switched to mapping the site with an IP address instead of a server/domain name, could this be the culprit?

    I encountered exactly the same problem.
    I'm trying to solve this problem...

  • Move all my music to another folder but Itunes can't find the files!

    I have all my music on my desktop in small folders for each artist.
    But now i don't have room anymore, because i have to much music.
    So i want to move it all in to a folder called "Music". But when i do that
    Itunes can't find the files, and i have to search for each file, to find the new location instead of the desktop. How do i move my music more easily? So i don't have to synchronize it all in again, with the right album covers and that..
    Please, need some help here!

    You need to open your preferences file in iTunes and click on advance then select the location of where you put the folder.  http://support.apple.com/kb/HT4527

  • Selected file cannot be linked because its type (video) does not match the original file's type

    I've been using Premiere Elements 9 for a couple of years now, and a few months ago I began having problems importing AVI files created from a BlackMagic Intensity Pro capture card.  (These issues were not previously occurring, and since they surfaced, I have exhausted the various settings for the BlackMagic card, used various software such as BlackMagic's own Media Express as well as the freeware VirtualDub, and still have the following problems.)
    In addition, these AVI files play just fine, in their entirety, using Windows Media Player and in Quicktime.
    The problem (or possibly two, but I suspect they could be related) is that most of the AVI files I attempt to import will either (1) import all video and NO audio, or (2) import ONLY a short segment of audio and video, and the length that Elements imports varies.  Usually only in the range of a minute or two.  The rest of the file is not imported at all.
    After much digging in forums, and testing various settings in trying to figure out the issue, I decided to back up all of my files and completely wipe all hard drives and start over with a fresh installation of Windows and Premiere Elements 9.  I haven't installed much else yet, as I wanted to first find out if the reinstallation improved things with Elements.
    For the first project I created in Elements after the reinstallation, Elements successfully imported an entire AVI that was nearly 2 hours long, audio and video.  This was a file that previously would not import properly into Elements.  This suggested that my earlier installation of Elements must have been corrupted somehow.  At this point I was very hopeful that all was well.
    I proceeded to edit the video as I had wanted, saved the project, and exported it to an MPEG format file.  I had originally wanted to export it as an MOV, but I hadn't yet installed Quicktime, so Elements couldn't do that just yet.  The MPEG export was successful and plays fine.
    However, I then installed Quicktime, and once it was finished, I restarted the PC and reloaded the same project.  This time, Elements claimed the media was offline.  I double-clicked on a segment of the video, and directed Elements to the raw file, but then an error message popped up:  "The selected file cannot be linked because its type (video) does not match the original file's type (audio and video)."  This was the same file I had JUST edited and of which I created an MPEG.
    I tried creating a new project and the "Get Media" function to import the AVI again, but this time only the video imported with NO audio.  (This would explain why the error message said what it did, but not why the audio wasn't imported.)
    What in the world is going on with Elements???  I am baffled since the ONLY task I have done on this machine after a complete reinstallation of both Windows and Elements is edit one AVI.  I find it very hard to believe that just installing Quicktime caused this.
    Some info on my system:
    System:  Asus P6T w/ Intel i7 920 and 12 GB memory
    OS: Windows 7 Ultimate
    Video Software:  Premiere Elements 9
    Capture Card:  BlackMagic Intensity Pro (PCI-e)
    Capture Software:  AVIs recorded with either BlackMagic Media Express or VirtualDub (only prior to the reinstallation, as neither of these programs are currently installed)
    I'm getting to the point with Elements that I might need to just abandon it and find something else that is more reliable.  Anybody have suggestions to help with this, so I won't have to migrate?

    mtnsports
    We think that we need to start off with definiting the properties of these .avi files that you are importing into Premiere Elements 9.0/9.0.1 (assumed that you are working for the required 9.0.1 Update).
    You say that the "avi" was created from a "BlackMagic Intensity Pro capture card". What are the properties of this .avi that you imported into Premiere Elements? Not all .avi are created equal. What is the video and audio compression, frame size, frame rate, interlaced or progressive, pixel aspect ratio, typical duration?
    Based on the properties of the video what have you been setting as the project preset?
    Let us start here.
    More later.
    ATR

  • Error message on my development workstation: The system cannot find the file specified.

    Post Author: cseverin
    CA Forum: Crystal Reports
    Hi,
    I am currently developing an ASP.NET website using Visual Studio.NET 2005. I am using the .NET 2.0 framework, VB.NET as my programming language and I connect successfully to a SQL Server 2005 database.  I can select, insert, update and delete data from the database elsewhere in my project, so I know basic connectivity isn't an issue.  The problem seems to be with Crystal Reports. 
    I created a folder called 'Reports' in my project and added a Crystal Report file (OpenFiles.rpt) to it.  I designed the report and initally used a hard-coded SQL query as its datasource so I could quickly get the database fields onto the report and preview them.  All worked fine. 
    To make the report accessible to the rest of the website, I created an .xsd dataset file containing the three tables (and their corresponding tableadapters) that the report requires and then redeveloped the report using the dataset as the datasource for the report.  After doing this, the preview no longer worked.
    Next, I added a page to the website and dragged a Crystal Report Viewer Control onto it.  In the code behind the page I wrote:
    Option Strict On
    Imports System.Data
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Partial Class Reports
         Inherits System.Web.UI.Page
         Private objOpenFilesreport As OpenFilesReport
         Private rptOpenFiles As ReportDocument
         Private strLastErrorMessage As String = Nothing
         Private errLastException As Exception = Nothing
         Dim strFileKey As String
         Dim strJurisdictionCode As String
         Dim strStaffId As String
         Dim strReportId As String
         Private Sub ConfigureCrystalReports()
              Dim reportPath As String = Server.MapPath("OpenFiles.rpt")
              Dim rptopenfiles As New ReportDocument
              rptOpenFiles.Load(reportPath)  <== I checked this during execution and the value correctly points to the OpenFiles.rpt file in the Reports     folder of my project
              Dim ConnectionInfo As ConnectionInfo = New ConnectionInfo()
              ConnectionInfo.DatabaseName = my database
              ConnectionInfo.UserID = login id of user
              ConnectionInfo.Password = user's password
              SetDBLogonForReport(ConnectionInfo, rptopenfiles)
              CrystalReportViewer1.ReportSource = rptopenfiles
         End Sub
         Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
             ConfigureCrystalReports()
         End Sub
         Private Sub SetDBLogonForReport(ByVal ConnectionInfo As ConnectionInfo, ByVal myReportDocument As ReportDocument)
              Dim myTables As Tables = myReportDocument.Database.Tables
              For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
                   Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
                   myTableLogonInfo.ConnectionInfo = ConnectionInfo
                   myTable.ApplyLogOnInfo(myTableLogonInfo)
              Next
         End Sub
    End Class
    I added a hyperlink to one of the existing pages on the website to navigate to this page with the report viewer on it.  When I run the website in Visual Studio and click on the hyperlink I get the following:
    Server Error in '/MyTest' Application.
    The system cannot find the file specified.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: The system cannot find the file specified.Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
    &#91;COMException (0x80004005): The system cannot find the file specified.
    &#93;
       CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0
       CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +126
       CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +442
    &#91;Exception: Load report failed.&#93;
       CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +513
       CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +1378
       CrystalDecisions.CrystalReports.Engine.ReportDocument.EnsureLoadReport() +149
       CrystalDecisions.CrystalReports.Engine.ReportDocument.get_DataDefinition() +85
       CrystalDecisions.CrystalReports.Engine.ReportDocument.get_ParameterFields() +158
       CrystalDecisions.Web.CrystalReportSource.BindControlParameter(Parameter parameter) +130
       CrystalDecisions.Web.CrystalReportSource.DataBindParameters() +191
       CrystalDecisions.Web.CrystalReportSource.EnsureParameters(Boolean forceDataBind) +90
       CrystalDecisions.Web.CrystalReportSource.LoadCompleteEventHandler(Object sender, EventArgs e) +47
       System.Web.UI.Page.OnLoadComplete(EventArgs e) +96
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4086
    Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832 
    Any ideas, anyone?
    Also, assuming I can get past this error, I will need to figure out how to fill the tables in the .xsd dataset file.  I have written a class for the dataset that includes functions that populate the tables in the dataset from the database by executing SQL queries.  But how do I call these functions at the time the report is run?
    This is my first Crystal report written in .NET and I've been struggling with it for days now.  Any help would be most appreciated!
    Thanks very much!
    Chris Severin

    hello, the error message is obviously coming from one of the installed mcafee extensions. please directly contact mcafee technical support - they can likely give you more detailed guidance and are the only ones who can fix bugs or make necessary adjustments in the addon.

  • Finder - Multiple files open - Bug persists in 10.6.2

    I upgraded to 10.6.2 yesterday. I have 3 Macs, a 24" iMac (Late 2007), a 2.53 GHz MacBook Pro (Feb 2009) and a Mac mini (March 2009).
    I tested the previous problem of opening multiple jpg files from the Finder, and in some cases they all open in one Preview window, but in many cases they open in two Finder windows. I see this problem on all 3 my Macs.
    This happens when I try to open a larger number of files, e.g. 30 or 40 files, typically they are around 40-100 kB big.
    So this bug seems to be a bit better, but it still is there, it has not been fixed.

    ok, hmmm do you have any thing thats set to open when you login? if not what i'd like you to do for me is test it in a new user. create a temp acct on the computer and see if it does it there. if it DOESN'T then from finder select go>home>library>preferences>and take the com.apple.finder.plist and move it to the desktop then restart. if it DOES happen in the second user then please let me know and ill see if if i can find any thing else other than to reinstall snow leopard. if you do have login items i'd like you to remove them and reboot to see if it still happens.
    >system prefs>accts>login items
    if you have any questions please ask

  • Edit in Photoshop CS4... does not open the selected file.

    Sorry if this is an old topic, but I can not seem to find the answer and I was hoping someone here might know.
    When in Lightroom (2.2 or 2.3) if I select "Edit in Photoshop CS4..." or any of those dropdown commands, Photoshop opens....and that is it. The selected photo from Lightroom is NOT opened/merged/panoramaized. duuh. frustrating.
    So I re-installed Lightroom, updated to the 2.3, re-installed CS4. all with the same effect that Photoshop opens, but the selected file is NOT opened.
    Has anyone experienced this? Any solutions?
    Thanks in advance.

    When you remove the obvious,
    that which is left must therefore be the truth -- Sherlock Holmes
    Short version:
    When I created a new lightroom catalog, and imported a single, standalone file, It worked fine. But when I imported to the new catalog, any photos from my existing catalog, it would fail.
    Turns out that I was doing something a bit out of the ordinary with the IPTC Copyright field. In order to make my copyright information look "different" when I would export a file.
    One would normally put in that field something like "© 2009 someone". I discovered a few months ago that I could make this field display as a multi line entry.
    ie.
    if you wanted to put XY into the copyright field, but wanted it to display as:
    X
    Y
    all you would have to do is to put a carrage return between the two characters. (hint ctl^enter). Now when you displayed the "copyright" in an output file, it will display
    vertically instead of all the characters in a horizontal line.
    After being frustrated by this for a couple of weeks, I simply started removing every option that I might have applied to photographs that I would import with Lightroom. One of the last ones was the "vertical" information I put in the copyright field in a Preset. (when you remove the obvious...).
    Funny thing is that no program really cares about the formatting of that field, or if it has multiple lines in the data, or special characters.......It even opens up just fine in Photoshop / Gimp / PSE / etc. with no problems.
    But, if you have multiple lines of data in the Copyright Field (and I suspect others as well),
    AND you want to open up the file from Lightroom in Photoshop, using the standard menu item of " Edit with Photoshop CS4", for some reason Photoshop will start, but never open the designated file. I would expect some parsing something just giving up after it encounters a CR.
    But.....All is well that ends well. Now I can quit obsessing, and move on to something else...
    Best,
    Jim

  • Not sure if this is the right place...Recovery or Finding missing files

    Hi,
    Again, not sure if this is the right place to ask, but its worth a shot.
    so i've been transcribing video all day using microsoft office for mac, and was saving the project (i thought) to an external hard drive. at one point the HD came unplugged, and i plugged it back in. no big deal. i continued to save, to type, save, type, etc until finished. so when i finished and saved the project, seemed okay. when i closed word, it kept asking me if i wanted to save changes...i said yes, and it would just ask me again, did this a few times. i assumed it was asking me to save it to a new location, which i didn't think i needed so finally said no.
    i then find out that somehow when the HD was unplugged it erased Words ability to save to said location. so my last save was really before the HD was removed, which is odd, because i kept saving and never was prompted the path was interrupted or anything.
    so my question is two part...
    1. where would i find in the depths of the computer the saved files? if i was saving, they had to have gone somewhere, but i dont know how to find them.
    2. also, assuming it wasnt saving, my word prefs say it autosaves every 5 minutes, so those files must exist somewhere also, yet can't find them...
    does this make sense, can anyone help me?
    thanks
    austin

    Hi there,
    In Finder, select Go menu>Go to Folder, and go to "/volumes".
    Volumes is where an alias to your hard drive ("/" at boot) is placed at startup, and where all the "mount points" for auxiliary drives are created for you to access them. This folder is normally hidden from view.
    Drives with an extra 1 on the end have a side-effect of mounting a drive with the same name as the system already think exists.
    See if it may be in one of those with a 1 or 2 added to it.

  • I got a new wireless connection for my mac and cannot figure out how to delete the last connection service I had. Everytime I shut the computer, the network goes back to the other one. I cannot find the file ANYWHERE

    got a new wireless connection for my mac and cannot figure out how to delete the last connection service I had. Everytime I shut the computer, the network goes back to the other one. I cannot find the file ANYWHERE

    Under Network Preferences, select the WiFi
    click on "Advanced..." button
    Select the network you want to delete from the list and click on "-"
    Click "Ok"
    Click "Apply"
    Well done ;-)
    You may also want to delete the wireless key from Keychain.
    Open Keychain, seach for the old wifi network name, slect it and click delete

  • How do I find a file in Time Machine?

    I get time machine. It just works. But my questions is, how do I locate a file that I know was backed up but I have no idea when the last time it was actually present on my system? Is there a way to just search like in Spotlight but have it show files that have been backed up?

    Open a Finder Window.
    In the Finder Window, search for the file you want, select "file name" or "content", make sure "This Mac" is selected.
    Click the Time Machine icon, in the dock, it will open on "Today".
    Click on the back arrow to go back in time.
    If the file was backed up, TM will go back and find it.

Maybe you are looking for