Find path of file.

I'm very new to Applescript.
I have a file name extracted from a plist. (My desktop pic).
Is the any way within a script to find the path to this file?
Thanks for any help.
Steeb

The full path should be in there also, but if all you have is the name you can use the find utility. There may be several files with the same name in different locations, so you might want to change the source folder (the folder to look in) to narrow the search:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #DAFFB6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
set sourceFolder to quoted form of text 1 thru -2 of POSIX path of (path to home folder) -- strip trailing delimiter
set fileName to quoted form of "test" -- the file name to match, can use wildcard characters
set theItems to (do shell script "/usr/bin/find " & sourceFolder & " -type f -and -iname " & fileName) -- case insensitive file name match
if the result is "" then
set theMessage to "none found"
else -- add returns between items for the dialog
set theMessage to paragraphs of theItems
set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
set {theMessage, AppleScript's text item delimiters} to {theMessage as text, tempTID}
end if
display alert "File names matching " & fileName & ":" message theMessage</pre>

Similar Messages

  • How to find the absolute path of file  which store in KM foler ?

    Hello everyone:
         We want to develop an ABAP program which can write files into KM folder directly.
         So I need to find the absolute path of file which store in KM folder first, then we can consider the develop solution.
         Is this issue possbile that an ABAP  program write files into KM folder  directly ?
         Is there anybody had done this job ?
    Best Regards,
    Jianguo Chen

    Hi,
    http://forum.java.sun.com/thread.jsp?forum=34&thread=36
    612The methods in the above topic seem to be available when use a DOM parser..

  • How to find PG.xml file name and path associated with a FUNCTION

    Hi,
    I am having a function:IRC_VIS_HOME_PAGE with Web HTML value as below:
    OA.jsp?akRegionCode=IRC_VIS_HOME_PAGE&akRegionApplicationId=800&OAPB=IRC_BRAND
    How to find PG.xml file name and path assoicated with above funtion.
    Thanks,
    ashok

    Ashok,
    Function IRC_VIS_HOME_PAGE will have 2 parameter defined for it which are OASF and OAHP where
    OASF=<SelectedFunctionName> - this tells the Framework to select this function in the given "Home Page" menu context.
    OAHP=<HomePageMenuName> - this is used ONLY with the OASF parameter, and it is used to establish the current menu context. It should point to a "Home Page" menu.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Trying to launch another profile, get: "Impossible to find the executable file. To fix this, set a valid path in the options window"

    When I try to launch another profile in firefox, I get this message: [JavaScript Application] Impossible to find the executable file. To fix this, set a valid path in the options window.

    Having this problem with FF21 Beta1, add-on version 1.5.0.2 on Win7 immediately after upgrading FF.
    I would try to make a shortcut to the other profile as you suggested, but I honestly don't even know where the file is, if its a separate config or another executable all together.

  • Unable to see the logical path and file created in FILE tcode from AL11 and unable to upload the file to this path from front end

    Hi Experts,
    I have created the logical path and filename in FILE tcode.I am trying to upload the pdf file to application server by using this path.But
    I am getting message like "Unable to open the file".Even I cannot find the this path in AL11 tcode.Kindly anyone advise how to upload pdf file using
    custom path and file created from FILE tcode.
    Thanks & Regards,
    Anusha.

    Hi Anusha,
    Please give as below.
    I forget to say you cannot open the PDF in AL11 and for that you need some configuration, i think it can be done using content server,not sure completely please wait for some more suggestions.
    Regards,
    Pavan

  • My LV program can't find the iak file when the program is loaded from a different PC.

    Hello all,
    My LV vi with Fieldpoint I/O and it's IAK file are stored on the company network.  If I load and run the LV vi from the PC it was developed on, everything is fine.  If I load and run on a different PC (that has an identical install of LV), the LV vi can't find the IAK file (all of the I/O pointers to the file are grayed out.) 
    Also, if I make an EXE out of the vi on the machine that can find the IAK, it won't find it if it's run from the other machine.
    It is not related to whether one machine has different "rights", as they are identical.  It's not related to different installs of LV, as they are identical.   
    I have found that this is related to the network login name/password, and to the machine's network name.  If I login on the second machine and try to run the program, it won't find the IAK.  If I point it to the IAK it will run.  If I save it and log out, and then login as a different user with the same rights on the second machine, it won't find the IAK again, until I re-point it there when I re-run it.  This is true for both the vi and the EXE.
    This problem makes deploying the EXE difficult to different machines, as the first time it's run, the EXE has to be pointed to the IAK.  Pointing the EXE to the IAK is difficult as these installations have no keyboard or mouse.
    Does anyone have any ideas on how to fix this so the LV vi or it's EXE finds the IAK from no matter where it's loaded from?
    Thanks,
    Mike

    Laura,
    I figured I'd continue this thread because it's along he same line..
    I have two Fieldpoint systems. They are identical, except for one thing...one has an AI-110 in position 7...the other has nothing. Both have the same IP address, etc and I swap the ethernet cable between them when I want to select which one I use.  I use a dedicated ethernet card to the FP processor...and it's not the company net.
    There are two IAK files...one for the system with the AI-110, one for the system without the AI-110. The two IAKs are in different paths.
    Before I had the system and the IAK without the AI-110, I made an EXE of the code that woked with the AI-110, and it worked fine.
    But now if I run the EXE after I've used MAX and opened the IAK without the AI-110, the EXE won't read the AI-110!  I have to go back into MAX and open the IAK that has the AI-110 in it, close MAX and restart the EXE for the EXE to see the AI-110.  (Max is NOT SET to "Download Items on Save")
    I looks like the EXE is looking at MAX to get the IAK or a pointer to the IAK.
    Did I build my EXE incorrectly?  Shouldn't an EXE completely ignore MAX once it's made?
    Thanks,
    Mike

  • I keep getting the message, "Windows cannot find 'c:\Program Files (x86)\Mozilla Firefox\firefox.exe'. Make sure you typed the name correctly, and then try again." I get it when I either try to open it from the Start menu or from the desktop icon.

    I've just installed Firefox on my laptop and keep getting the message, "Windows cannot find 'c:\Program Files (x86)\Mozilla Firefox\firefox.exe'. Make sure you typed the name correctly, and then try again." I get this message whenever I either try to open it from the Start menu or from the desktop icon. I've never gotten it to work and even uninstalled it and then redownloaded it and still cannot get it to open. Any help would be greatly appreciated!!!!

    Are you installing from the official site? http://www.mozilla.com/firefox
    If you use Windows Explorer (My Computer) to check that path, is the Mozilla Firefox folder there? That is the normal installation location, but I think it's worth checking.
    If the folder isn't there or firefox.exe is not in it, I wonder whether some other software might be interfering. You might want to run some supplemental security scans. These two tools are highly regarded:
    Malwarebytes Anti-malware : http://www.malwarebytes.org/products/malwarebytes_free
    SUPERAntiSpyware : http://www.superantispyware.com/

  • "File file path:to:file is already open" how do i close it?

    I am trying to write a script that pops up a dialog box, asks for text and saves this to a .csv and a .txt This is so i can quickly record what i am doing and the times i am doing it, makes quick notes and various things like that. However it is failing with the message "File file path:to:file is already open" so how do i close the file or get around this. Cheers
    Script Below
    tell me to activate
    display dialog "Enter the log message:" default answer "" buttons {"Cancel", "Ok"} default button "Ok"
    copy the result as list to {the log_message, the button_pressed}
    if the button_pressed is not "Cancel" then
    set curTime to (do shell script "date \"+%H:%M:%S\"")
    set curDate to (do shell script "date \"+%Y%m%d\"")
    set new_foldername to curDate
    set this_folder to (path to current user folder) as text
    set fPath2 to this_folder & "Documents:Logs:Date:" as alias
    --set this_folder to "Macintosh HD:Users:username:" as alias
    tell application "Finder"
    if not (exists folder new_foldername of fPath2) then
    make new folder at fPath2 with properties {name:new_foldername}
    end if
    end tell
    set fPath to (path to current user folder as Unicode text) & "Documents:Logs:Date:" & curDate & ":"
    set fName to curDate & ".csv"
    set myFile to open for access file ((fPath as string) & fName) with write permission
    write curTime & "," & log_message & return to myFile starting at eof
    close access myFile
    set fName2 to curDate & ".txt"
    set myFile to open for access file ((fPath as string) & fName2) with write permission
    write curTime & " " & log_message & return to myFile starting at eof
    close access myFile
    end if

    Hi Richard,
    Run this in the script editor:
    set f to choose file
    close access f
    Navigate to the file you left open. Probably there was an error and the file was left open because it never reached the 'close access' command.
    gl,

  • Itunes was working fine. Tries to install latest upgrade and get error message about an invalid character in the path "Program Files (x86)". PC, Win7, nothing else appears to be having same issue.

    Itunes was working fine. Tried to install latest upgrade and get error message about an invalid character in the path "Program Files (x86)". PC, Win7, nothing else appears to be having same issue. Program still works, simply cannor upgrade.

    Thanks b noir,
    I tried this solution without success. After FixIt ran and didn't find a problem, either in looking for issues with "software upgrade" or "iTunes" it kindly offered to help me uninstall iTunes. I had thought of this as a possibilty but it seems to me that if you do that you lose a lot of "non-native-to-Apple" information you might have entered. I did this once and recovery was painfull. Is there a way to uninstall iTunes without losing all of that sort of thing? Any help would be appreciated.

  • ITunes Update attempt: "The folder path 'Program Files' contains an invalid character"

    How can I install the latest version when I get this message : "The folder path 'Program Files' contains an invalid character"? The message appears when I try to install the update and it appears when I try to uninstall the previous version. The instructions for manual uninstall says to use the Control Panel Uninstall Programs first and then "clean up" -- but I can't use the Control Panel Uninstall. I am running iTunes from an external drive. What to do?

    That's normally produced by a damaged iTunes.msi. The basic treatment for it is given in the following user tip:
    ["not a valid short file name" and "invalid character" install errors|http://discussions.apple.com/thread.jspa?threadID=2368028]
    ... but since Microsoft pulled the Windows Installer CleanUp utility from their Downloads Center, things have grown more difficult. First we have to find a copy of the utility.
    Let's try Googling. (Best not to use Bing, I think.) Look for a working download site for at least version 3.0 of the Windows Installer CleanUp utility. After downloading the utility installer file (msicuu2.exe), scan the file for malware, just in case. (I use the free version of Malwarebytes AntiMalware to do single-file scans for that.)
    If the file is clean, to install the utility, doubleclick the msicuu2.exe file you've downloaded.
    Now start with *step 4* from the user tip, and proceed from there.
    (If you do find a clean download site for the correct version of CleanUp, please don't tell me where it is. Without wishing to sound paranoid (although I grant it does sound paranoid), there is a non-zero chance that posting links to download locations for the utility here at Discussions leads to that download location being shut down.)

  • I cannot load I Tunes or delete it as the download stops and says the folder path "program files"contains an invalid character, what can I do?

    I cannot load or delete I Tunes from my computer. What comes up is- The folder path "program files" contain an invalid character?

    That's normally produced by a damaged iTunes.msi. The basic treatment for it is given in the following user tip:
    ["not a valid short file name" and "invalid character" install errors|http://discussions.apple.com/thread.jspa?threadID=2368028]
    ... but since Microsoft pulled the Windows Installer CleanUp utility from their Downloads Center, things have grown more difficult. First we have to find a copy of the utility.
    Let's try Googling. (Best not to use Bing, I think.) Look for a working download site for at least version 3.0 of the Windows Installer CleanUp utility. After downloading the utility installer file (msicuu2.exe), scan the file for malware, just in case. (I use the free version of Malwarebytes AntiMalware to do single-file scans for that.)
    If the file is clean, to install the utility, doubleclick the msicuu2.exe file you've downloaded.
    Now start with *step 4* from the user tip, and proceed from there.
    (If you do find a clean download site for the correct version of CleanUp, please don't tell me where it is. Without wishing to sound paranoid (although I grant it does sound paranoid), there is a non-zero chance that posting links to download locations for the utility here at Discussions leads to that download location being shut down.)

  • I want to change the file location for the automatic backup file bookmarks.file, but I can't find browser.bookmarks.file in the list on the about:config page.

    I asked about automatic backup of bookmarks and received the following answer:You can make Firefox 3 create an automatic HTML backup (bookmarks.html) when you exit Firefox if you set the pref [http://kb.mozillazine.org/browser.bookmarks.autoExportHTML browser.bookmarks.autoExportHTML] to true on the about:config page. That backup is created by default in the profile folder as bookmarks.html, but you can set the file name and path via the pref [http://kb.mozillazine.org/browser.bookmarks.file browser.bookmarks.file] on the about:config page. I went to about:config page and toggled browser.bookmarks.autoExportHTML to “Yes” and it’s working. However, I want to change the file location, but I can’t find browser.bookmarks.file in the list.

    The browser.bookmarks.file preference does not exist by default. Right-click in about:config and select "New > String" to create it.

  • How to find out the file name

    Hi,
    In selection screen (parameter) user will give input TXT file from presentation server to upload to SAP. I need to capture the file name only but not the path and need to concatenate with date stamp and need to download error log in XLS file to presentation server.
    How to find out the file name from selection screen?
    I searched SCN threads but not found relavant solution.
    Thanks,
    R Kumar

    Hi
    This code gets only filename from selection screen :
    REPORT x.
    PARAMETERS p_file(100).
    DATA : gv_full_path LIKE  ibipparms-path,
           gv_full_path_string TYPE string,
           gv_filename(100),
           gv_file_ext(3).
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Ask user to select file with a popup :
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          file_name = gv_full_path.
    Get filename from path :
      gv_full_path_string = gv_full_path.
      CALL FUNCTION 'CH_SPLIT_FILENAME'
        EXPORTING
          complete_filename = gv_full_path_string
        IMPORTING
          extension         = gv_file_ext
          name              = gv_filename.
      CONCATENATE gv_filename '.' gv_file_ext INTO gv_filename.
      p_file = gv_filename.
    I hope it helps.

  • 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>

  • ITunes can't find my music files

    It appears all my songs have lost the path to their music files. The error message says "cannot find the original file do you want to locate it?" When I look in the Music folder they appear in the artist's folder but still will not play. Any suggestions?

    I found a solution to this on a different thread from 2005 (but it still applies) - I promised myself that, if it worked, I would spread the news... the joy. It worked! (here is the link - http://discussions.apple.com/thread.jspa?messageID=7709257#7709257) I copied the note, too (the only difference is that the "Copy Files to iTunes Music Folder selection is now in Preferences> Advanced):
    It's possible that not all of the songs in your previous iTunes library were stored in your default iTunes Music folder. At this point, you should probably just double-check to make sure your default iTunes Music folder is set correctly (to the library on the new HD) and then go to iTunes > Preferences > General and make sure the option Copy files to iTunes Music folder when adding to library is deselected. Then select all the songs in iTunes, and press Delete. Follow the prompts to remove the songs from your iTunes library, but NOT to remove them from your computer. Then, with a Finder window open, select everything in the folder iTunes Music on your new HD and drag and drop it onto the iTunes player window.
    Please read the above instructions carefully, then read them again even more carefully, before proceeding.
    It's a little scary, but as long as you make sure that you do not move the files to the trash on the second prompt you'll be fine. You can just drag you iTunes Music Folder into the player window and all of you sub-folders will copy back into iTunes.

Maybe you are looking for