File path from find command and using POSIX

Hi,
I have a find command in do shell script returning output files of the form ./xyz/abc/.../...
instead of the full path.
I am guessing that this is the problem when I use POSIX path of one of those files. Can Applescript understand the "./" or does it need a full Unix path to convert it back?
In that case, how do I ask find command to return the full path?
Thanks in advance!

>I am guessing that this is the problem when I use POSIX path of one of those files. Can Applescript understand the "./" or does it need a full Unix path to convert it back?
You're right - AppleScript won't be able to use those paths because AppleScript has no idea of the current directory used by the shell.
The problem is that you're defining '.' a the start point of your search.
For each matching file find will print this start point in front of the relative path, assuming that you know where you're starting from. So the solution is to provide that path as the search start point rather than .
For example, if your current script says:
<pre class=command>cd /some/directory
find . -name "*.mp3"</pre>
You could/should rewrite this as:
<pre class=command>find /some/directory -name "*.mp3"</pre>
in the second case all matches would include the full path including the /some/directory part.
If you can't predict what your search directory will be you can write your find like this:
<pre class=command>find `pwd` -name "*.mp3"</pre>
which will fill in the current directory (via pwd at the time the search is executed and will output full paths that AppleScript can work with.

Similar Messages

  • [b]HOW TO:[/b]  Copy and Paste THE Filename AND its PATH from Finder

    HOW TO DO THIS: Copy and Paste THE selected Filename AND its entire PATH from Finder to another application as in document footer reference, or document database which has a path field to aid in locating the file later.
    Finder, Spotlight and File Info (can be used to display Path) or using Command F, command I, etc. but user is not allowed to copy the path to clipboard.
    This is rudimentary, yet the word Path, is unknown to Mac Help.
    Message was edited by: jbov

    AJ,
    Isn't it amazing....There is no Command Key for this action? Apple Care was confounded too. And thanx, it'll be a help....
    Jim
    its tedious, but this should work:
    open a terminal window.
    Drag and drop the icon for the file in the terminal
    window.
    This will put the full path including the filename on
    the command line.
    Copy the path from the command line, and paste
    (wherever).
    Close the terminal window.

  • External hard drive -- old file path from a previous laptop is still where to find my songs,  how do I change?

    My iTunes library is a mess, it is stored on an external hard drive.  My old laptop died unexpectedly and I didn't have a problem resetting the file path for the library on my new laptop.  The other day my son was trying to update his iPod when I wasn't home and I don't know what he did.... GRRRR  Any songs I purchased on my old laptop are now not able to be found.  When I click on 'get info' on a song it shows the old file path from the old laptop.  Songs that I purchased since the new laptop are still playable and great.  I know my songs are still there but I can't seem to get the file path to reset on the old music.  HELP!!! PLEASE

    This happens if the file is no longer where iTunes expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, or that the drive it lives on has had a change of drive letter. It is also possible that iTunes has changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout,or vice-versa, and so is looking in slightly the wrong place.
    Select a track with an exclamation mark, use Ctrl-I to get info, then cancel when asked to try to locate the track. Look on the summary tab for the location that iTunes thinks the file should be. Now take a look around your hard drive(s). Hopefully you can locate the track in question. If a section of your library has simply been moved, or an external drive letter has changed, it should be possible to reverse the actions.
    Alternatively, as long as you can find a location holding the missing files, then you should be able to use my FindTracks script to reconnect them to iTunes .
    tt2

  • Issue with Getting the file path from InputFile component

    Hi,
    One of our requirement is like below:
    I am working on ADF 11g (latest release R1) page. User will select the file and when he/she clicks on the Save button we need to store the file path in the database.
    In the database file_path is varchar2(300). We need to store just the file path. I am using InputFile component but filepath is not getting inserted.
    This is really urgent. It would be really appreciate if anyone can guide me on this.
    Thanks
    MC

    Hi Mahesh,
    I have manage to store the file path from the InputFile component in Jdev 11g. I found the file upload script from this forum and manage to alter it so that i could save the file path to the database. But my problem is to retrieve it back to view as a document. Hope this will help you :)
    This is an example of what I have manage to save to my DB :
    (CLOB) //192.168.238.53/c$/Research/Docs/0906160744/EyeCandyLog.txt
    In my form, I save the file path first before I update the other fields. My code is something like this :
    public void uploadFile(ValueChangeEvent valueChangeEvent) {
    // Add event code here...
    InputStream in;
    FileOutputStream out;
    if(tanda == 0){
    try {
    // final Context context = getInitialContext();
    RS01Proposal rS01Proposal = (RS01Proposal)new InitialContext().lookup("Phase2-RS01Proposal#sr.model.RS01Proposal");
    id = rS01Proposal.dptProposalid();
    tanda = tanda + 1;
    System.out.println("tanda"+ tanda);
    } catch (Exception ex) {
    ex.printStackTrace();
    System.out.println("id"+id);
    proposal = id.substring(6);
    System.out.println("proposal"+proposal);
    UploadedFile file = (UploadedFile)valueChangeEvent.getNewValue();
    String fileUploadLoc = "//192.168.238.53/c$/Research/Docs/"+id+"/";//The place where file will saved
    //create upload directory
    boolean exists = (new File(fileUploadLoc)).exists();
    if (!exists) {
    (new File(fileUploadLoc)).mkdirs();
    if (file != null && file.getLength() > 0) {
    FacesContext context = FacesContext.getCurrentInstance();
    FacesMessage message =
    new FacesMessage("File Uploaded " + file.getFilename() +
    " (" + file.getLength() + " bytes)");
    *// extracting the file message to get the path*
    context.addMessage(valueChangeEvent.getComponent().getClientId(context), message);
    columnL = valueChangeEvent.getComponent().getClientId(context);
    column = columnL.substring(9);
    System.out.println(column);
    columnLengkap = "RS01"+column.toUpperCase();
    System.out.println("columnLengkap"+columnLengkap);
    *try {*
    out = new FileOutputStream(fileUploadLoc + "" + file.getFilename());
    in = file.getInputStream();
    *for (int bytes = 0; bytes < file.getLength(); bytes++) {*
    out.write(in.read());
    in.close();
    out.close();
    } catch (IOException e) {
    e.printStackTrace();
    } else {
    String filename = file != null ? file.getFilename() : null;
    String byteLength = file != null ? "" + file.getLength() : "0";
    FacesContext context = FacesContext.getCurrentInstance();
    FacesMessage message =
    new FacesMessage(FacesMessage.SEVERITY_WARN, " " + " " +
    filename + " (" + byteLength + " bytes)",
    null);
    context.addMessage(valueChangeEvent.getComponent().getClientId(context),
    message);
    System.out.println(fileUploadLoc+file.getFilename());
    a = fileUploadLoc+file.getFilename();
    b = b + 1;
    if (flagInsert == 0){
    try {
    // final Context context = getInitialContext();
    RS01Proposal rS01Proposal = (RS01Proposal)new InitialContext().lookup("Phase2-RS01Proposal#sr.model.RS01Proposal");
    rS01Proposal.insertDoc(id,proposal,columnLengkap,a);
    flagInsert = flagInsert + 1;
    System.out.println("tanda"+ tanda);
    //session
    ProposalSession.storeCurrentProposalId(id);
    } catch (Exception ex) {
    ex.printStackTrace();
    }else{
    // update proses
    try {
    // final Context context = getInitialContext();
    RS01Proposal rS01Proposal = (RS01Proposal)new InitialContext().lookup("Phase2-RS01Proposal#sr.model.RS01Proposal");
    rS01Proposal.updateDoc(id,proposal,columnLengkap,a);
    flagInsert = flagInsert + 1;
    //session
    ProposalSession.storeCurrentProposalId(id);
    System.out.println("tanda"+ tanda);
    } catch (Exception ex) {
    ex.printStackTrace();
    }

  • How to get folder(directory path only not file path) from local file system

    Hi Firends,
    How to get folder(directory path only not file path) from local file system , whenevr i will click on browse button.
    Please give reply for this one , if anybody knows.
    Thanks,
    Anderson.

    Hi Anderson,
    if you're using flash.filesystem.FileReference - then it is run in black box - except of filename, size and creation data (and few other properties available after some operation succeeded). This is part of security features in Flash runtime (described in header section):
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference .html
    This for example implies that user can download a content to local machine - but that content cannot be loaded back into Flash runtime. For this you would need either Air runtime flash.filesystem.File:
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.h tml
    (so you would created Air runtime based application: desktop or mobile but not web, even as standalone project) or you would need one of 3rd party tools that add file access/file information features to standard Flash runtime applications converted to standalone native applications.
    hth,
    kind regards,
    Peter

  • How to Serialize a file path from client to server?

    I am using serializing concepts in java. I am stuck, that how can i send only file path from client to server?

    Um, ill take a wild guess and say that youre trying to
    access a file on another computer using that path?
    That wont work.
    What could the other computer possible do
    with that path unless both computers are networked to a
    common drive, or if they are networked to each other in a way
    where the root in the file path would point to the same place
    on either computer?

  • How to backup files to ensure future access and use using a different mac

    I recently attempted access backed up data on my LaCie drive from a different Mac notebook. I was blocked. I didn't write down the message, but it essentially advised that the data was locked and I wasn't allowed access. I wasn't given a chance to enter any kind of system password to bypass the lock.
    Here is my problem: I recently spilled some wine into my keyboard. Since then, the system has slowed to a crawl and occasionally weird things begin to happen, regardless of which software I am using [eg iPhoto, Quickbooks, idvd, Photoshop, email, and even dashboard]. I know I am very lucky to have any access to my files at all. While I do, I need to back everything up so that I can have access to my files later on. I plan to have my Mac serviced this week. I don't know if it needs to be replaced, or whether it can be repaired.
    *+If it can't be repaired, how do I back up my files to ensure future access and use using a different mac?+*

    I'll check the example you linked. I appreciate you responding.
    I was not trying to boot another system at all. Actually, I was working on a newer mac laptop. I attempted to load a dvd I had created in my idvd on the other mac from the LaCie. I was using a mac because I knew it had all the iLife software I needed in order to work with my idvd components. Honestly though, I don't know if the mac I was using is intel based. I hadn't considered it. Does Apple sell macbooks with intel? No matter.
    So, let's see -- I was using the other powerbook to read the LaCie via firewire -- and yes, the LaCie has its own power supply.
    If I remember correctly, the denial I received [when attempting to load the idvd file] knew that I had created it. I got the feeling that it wasn't allowing me into the file for security reasons. I just don't remember setting security. Incidentally, I just checked and I do not have a master password set nor do I have FileVault protection turned on.
    I'll check that link you sent. Thx again, M~

  • HT201210 restoring ipod and it say's can't find software and use a cd-rom if necessary. what am i supposed to do? my ipod is stuck on the connect to itunes screen and wont do anything.

    Restoring ipod and it say's can't find software and use a cd-rom if necessary. My ipod is stuck on the connect to itunes screen and wont do anything. What am i supposed to do?
    Please help, i will be very grateful

    you can do is go to ijailbreak.com then select downloads section.......scroll down and see the latest version of ipod touch second generation is available for download.....when it gets downloaded connect your iPod to itunes or keep it connected then hold option and click restore (mac) search the software by writing in search "iPod" a thing with white cube will show up if it is the file you just downloaded click it and wait for itunes to do its work......you can ask more if you are on windows

  • File path from specific directory

    hi all ,
    How to get full file path from specific directory having many folder inside that directory.
    I have file name and main directory name,please help me if you know about it

    I recognize that this post is half a year old at this writing, and the OP has probably long since either solved or abandoned the problem in question. That being stipulated: if I understand the question properly, the OP is stating that there is a directory named A, and contained somewhere within that directory or one (or more) of its subdirectories is one (or more) file(s) named abc.txt, and OP would like to be able to locate and obtain the canonical path to said file(s). While I am in no way a java maven, I've written a brief program which appears to do exactly that:
    import java.io.*;
    public class Main {
        public Main() {
            String whatImLookingFor = "abc.txt";
            String startingDirectory = "A";
            File path = new File("A");
            recursivelySearch(path, whatImLookingFor);
        private void recursivelySearch(File path, String whatImLookingFor) {
            try {
                if (path.isFile()) {
                    if (path.getName().equals(whatImLookingFor))
                        System.out.println(path.getCanonicalPath());
                else
                    if (path.isDirectory()) {
                        File[] currentFiles = path.listFiles();
                        for (int i=0; i<currentFiles.length; i++)
                            recursivelySearch(currentFiles, whatImLookingFor);
    catch(IOException ioe) {
    System.out.println("During search got error "+ioe.getMessage());
    public static void main(String[] args) {
    new Main();

  • How to get physical file path from logical file path

    Hi
    there is a immediate requirement ,
    I have logical file path but I need to get physical file path from it.
    So is there any FM which providesthis functionality.
    Points will be rewarded.
    Thanks

    Can you please share the piece of code ?
    Which File APIs are you using ?
    For java file, you can get complete path by simple method call : getAbsolutePath() on file object.
    Regards,
    Ashwani Kr Sharma

  • Entering a file path into Finder or elsewhere?

    can anyone help me if there are one or more ways to find a path like this in finder or other software? i have recently realized that i don't know how to take a file path such as this and then get my mac to show me where this is without "manually" finding it myself. also, i would love any other info on this type of topic or closely related topics if there are any that a new user should be aware of...
    /Users/mini_me/Library/Application Support/Postbox/Profiles/jaw8jgkk.default/Mail/Local Folders
    TIA

    That particular keyboard shortcut is coded into the Finder, which is an application even though we don't usually think of it that way. In other apps, it might do something else, or nothing at all. For instance, in Safari, "⇧⌘G" is the shortcut for finding the previous instance in a search (it's on the "Find" menu item of the "Edit" menu).
    You are right about the Keyboard Shortcuts section of the Keyboard system preference. Note that you can also create shortcuts as well as change ones that appear there, & they can be either "global," applying to all apps or specific to a selected app. However, the shortcuts you create will not override ones coded into an app.
    If you click the purple question mark icon in the preference, the help topic that appears will give you a little more info about this.

  • My Xtreamer media player won't read srt sub files downloaded from my iMac and stored in a 1Tb seagate external disk. However, the Xtreamer Elvira media player will read all the .avi files I have loaded in the external disk. Any ideas?

    My Xtreamer media player won't read srt sub files downloaded from my iMac and stored in a 1Tb seagate external disk. However, the Xtreamer Elvira media player will read all the .avi files I have loaded in the external disk. Any ideas?

    I am experiencing the same issue with a new external DVD burner, a Sony DRX-840U. When I load a CD into this external drive it appears in iTunes but when you go to import or play the CD iTunes indicates playing or importing for each individual track for just a moment. The end result is that nothing is ever imported or played. I am experiencing this on two different systems. One a notebook running Win2K and the other a desktop running XPpro. If I use the internal DVD drives on either of these systems everything work just fine. Yet I am able to use this new external DVD drive with every other application. For example Window Media Player has no problem playing or importing the same CD that iTunes fails on. The last person indicated that if one set the DVD drive in question to be the drive of choice under preferences>advanced>burning that all was ok. I my case this Sony external drive is the drive listed as the drive of choice for burning yet the issue still exists.
    As this appears to be an issue that others are also experiencing help from Apple Tech Support would be greatly appreciated.

  • Starting yesterday I can scan a pdf file in from the scanner and can not send a pdf in an email attachment

    Starting yesterday I can scan a pdf file in from the scanner and can not send a pdf in an email attachment.  What happened?  Windows 8

    Adobe Reader can't scan documents. What software do you use?

  • My daughter wants to remove herself from our plan and use a different cell provider. However, our contract is not yet up, what is the penalty for removing her early?

    My daughter wants to remove herself from our plan and use a different cell provider. However, our contract is not yet up, what is the penalty for removing her early?

    For contacts started before November 14, 2014, the ETF is $350 minus $10 per month of the contract term completed for smartphones. For other ddv6,it is $175 minus $5 per month of the contract term completed. You will need to call customer service at 1-800-922-0204 or *611 to find out the ETF amount for contracts started on and after November 14, 2014.

  • I am using DNET PCI card from other vendor and using Labview 2013

    i am using DNET PCI card from other vendor and using Labview 2013.
    is it possible to communicate with this DNET card?
    if so how do i find communication visa DNET ?
    please inform me how to find DNET examples.
    thanks,
    san

    Hi santh,
    I don't think it's possible to use a 3rd party DNET PCI with LV API.

Maybe you are looking for

  • Error while compiling java file using J2SE 1.5.0

    Dear Sir, I'm getting the following error while compiling the java file.The code is also given. package test; public class TestRowSet { public TestRowSet() { "TestRowSet.java": cannot access java.lang.Object,bad class file: D:\Program Files\Java\jdk1

  • Business Objects in CRM 2007

    What are the main business objects in CRM 2007 and how does this module interact with other SAP modules?

  • 1841 Load Balancing and Failover

    I have an 1841 router with a HWIC-4ESW (4port switch) card installed. The 4ESW is setup as VLAN1 and serves the internal network as the default gateway. The FE0/0 and FE0/1 interfaces are each connected to a ADSL Router. I currently have one WAN inte

  • Upgrade Prime Infra 1.4 to 2.0: is there no way other than fresh install

    Hello, We want to upgrade a Prime Infrastructure from 1.4 to 2.0. Cisco document says that there is no upgrade path from Prime Infrastructure 1.4 to Prime Infrastructure 2.0. So how to do if I want to upgrade from 1.4 to 2.0: I have to insert all con

  • Mac data recovery tool

    Use an automatic data recovery tool to successfully recovery any kinds of lost data on Mac System. You can easily download one of such software online. You can download the demo version and see whether it works or not. For more details on Mac data re