Getting path of parent folder of a file during a workflow execution

How can I get the parent folder/directory of a file during the execution of a workflow? I cant't find any actions i Automator that will give me this.
I want to make a general applicable automated workflow. The path can not be hardcoded in the workflow as different files and folders will be worked on each time the workflow is run.
The input to the workflow is a file or list of files. I want to be able to retrieve the path of the parent folder of these files at runtime.
Will I have to do this through AppleScript? If so, then how?
(in case you have seen my first post on this; it seems I wasn't specific enough so people didn't understand what I want to do. Therefore this second post. Sorry for the iconvenience)

Hi anilsen!
If all selected files are within the same folder, it would be like this:
For example:
• Get Specified/Selected Finder Objects
• Run AppleScript
on run {input, parameters}
tell application "Finder"
set output to (container of item 1 of input) as alias
end tell
return output
end run
Spazek

Similar Messages

  • How to get path or parent folder

    Hello
    I'm overriding method extendedPreAddRelationship on class S_Relationship.
    My purpose is to check whether the document is being put in the correct path or not.
    I can get folder name and document name using following code:
    AttributeValue av;
    av = def.getAttribute(Relationship.LEFTOBJECT_ATTRIBUTE);
    S_PublicObject folder = (S_PublicObject) av.getPublicObject(this.getSession());
    av = def.getAttribute(Relationship.RIGHTOBJECT_ATTRIBUTE);
    S_PublicObject document = (S_PublicObject) av.getPublicObject(this.getSession());
    What I need is the whole path (or at least the parent folder). Can I get path somehow? Or should I try to search parent folders?
    Jaska

    My purpose is to check whether the document is being put in the correct path or not.Hi,
    I had a similar problem - I needed to compare the path of current folder with path from parameters. Because I wasn't be able to get the path of folder, I did it in reverse way, comparing the folders. To get folder from path I needed getRootFolder method, which wasn't in server-side classes, so I extend S_TieFolder class:
    * Analogy of LibrarySession.getRootFolder().
    public static S_Folder getRootFolder(S_LibrarySession session)
    throws IfsException
    S_Folder folder = null;
    try
    Collection c = session.getValueDefaultCollection();
    S_ValueDefault vd = (S_ValueDefault)c.getItems("RootFolder");
    AttributeValue av = vd.getPropertyValue();
    folder = (S_Folder)av.getPublicObject(session);
    catch(Exception e)
    throw new IfsException(21020, e, session);
    return folder;
    In extendedPreAddItem method of S_TieFolder:
    S_Folder paramFolder = (S_Folder)getRootFolder(session).findPublicObjectByPath(folderPath);
    if( this==paramFolder ) ...
    Radek
    [email protected]

  • Getting the path of the parent folder of a file?

    How can I get the parent folder/directory of a file? I cant't find any actions i Automator that will give me this.
    Will I have to do this through AppleScript? If so, then how?
    Anders

    Mine should work as a stand-alone applescript droplet (save it as an application) from Script Editor.
    This code will work in an Automator "Run Applescript" Action after a "Get Selected Finder Items" action:on run {input, parameters}
    set pathList to {}
    repeat with itemNum from 1 to count of input
    tell application "System Events"
    copy POSIX path of (container of (item itemNum of input)) to end of pathList
    end tell
    end repeat
    return pathList
    end run
    It returns an Applescript list of each path for all the selected finder items. I had to change (number of items of) to (count of) as it failed in the Automator workflow.
    If your workflow will only process one item at a time, then this will work in the workflow:on run {input, parameters}
    tell application "System Events"
    set thePath to POSIX path of (container of (item 1 of input))
    end tell
    return thePath
    end run

  • Display path to parent folder of bookmark

    It's been 3 weeks and no new nibbles so I'm tossing this chum back into the community waters.
    '''Key phrase below: I WOULD STILL LIKE TO SEE THE PATH...'''
    Another article showed me how to use the Parent Folder add-on to display the (duh) parent folder of a bookmark (see: https://support.mozilla.org/en-US/questions/855436?e=es&as=aaq ).
    While this was very helpful, I would still like to see the PATH to that folder in the display when searching for a bookmark.
    This functionality is present in Windows 7 (it's called Search. See http://windows.microsoft.com/en-US/windows7/help/videos/finding-your-files ).
    With over 12K bookmarks, managed as only a librarian can, I not only need to locate bookmarks for retrieval, but want to save new bookmarks to the "correct" folder. The path allows me to do this.

    I think you misunderstood (which was why I included the link to the Microsoft Windows 7 page). Before Firefox I used IE9 but both browsers run under Windows 7. I'm basically looking to emulate the functionality of the W7 Search tool when using Firefox (which the Parent Folder add-on tries to do, but not fully). Hope that clears things up?

  • Path of the folder in configuring file adapter

    hi i m doing a file to file scenario from one server to the other
    wat should be the path of the folder
    i tried with
    //172.27.34.250/sender
    for acessing sender folder in the C:
    but the file is not picked
    could u plz help me out of this

    HI,
    Clarify is it on your Xi server or remote server.
    as explained above if it is XI server , the use the folder name with shard path.
    else if it is remote server then use FTP instead of NFS.
    see the below links
    /people/sravya.talanki2/blog/2006/12/27/aspirant-to-learn-sap-xiyou-won-the-jackpot-if-you-read-this-part-iii see for file to file.
    and see the below links for FTP related threads
    /people/sravya.talanki2/blog/2005/08/23/sender-xi-ftp-adapter-with-regular-path-expression-150-abap
    /people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
    OS Command on FTP
    OS command line script - Need help
    FTP - Run OS Command before file processing
    Regards
    Chilla

  • Deployment question - dynamic folder of unknown files during install

    Hi,
    I'm curious to see if this would be possible in flex.  It doesn't seem to be directly possible, so perhaps there's a workaround?
    The question:
    Can I have a folder of files next to an .exe (or .air) install that will place this folder into the install location?
    The background:
    I'm making a photo viewer app.  I want it to be able to work completely offline, in case they don't have an internet connection.  I want this to be able to be used both in Windows and Mac.  I figured an adobe air program would be a good way to do this.
    The photos are going to be dynamic.  I want to burn a cd with the .exe and a folder of images that are not available at the time of packaging.  Can I do this?  Do I have to make some kind of custom install exe to copy the files over after installing the program?
    I was thinking of a workaround.  I'd rather see if I could do the above- but this would be an alternative.  Let the program install normally.  When the program starts up it checks for a CD in the drive and copies the files to the program files before loading.  If the program can't find any images in the program file and the CD ROM is not in the computer, I would throw an error saying to put the CD in the drive.  This would work right?  I see the storagevolumeinfo class but it doesn't seem like there's a way to differentiate types of removable media; only that they are removable.  Am I wrong?

    I see file type of "CDFS" on my CD-ROM drive.  I'm assuming I can use this to make sure the removable drive is a CD based on googling it.  It sounds like my backup plan can work.  I'm still curious about the main question with the dynamic folder on install though.

  • Getting path to application associated with file type

    Hello,
    I'm looking for a platform-independent way to get path to application associated with given file type. Desktop API introduced in JSE 1.6 seems to do this, but it only lanuches the app.
    Any suggestions will be apprecieted

    Okay then, how can I open the file in it's associated
    application AND get the Process object of app's
    instance?If it doesn't bother you that the app will only work on windoze, then you can use the shell "start" command on the file.
    Process proc = Runtime.getRuntime().exec(new String[]{"cmd", "/C","start",filePath});However waitFor() will only wait for the process to be launched, not completed. Since your program doesn't know what Windoze will choose to launch, this makes sense.

  • How can I list all folders that contain files with a specific file extension? I want a list that shows the parent folders of all files with a .nef extension.

    not the total path to the folder containing the files but rather just a parent folder one level up of the files.
    So file.nef that's in folder 1 that's in folder 2 that's in folder 3... I just want to list folder 1, not 2 or 3 (unless they contain files themselves in their level)

    find $HOME -iname '*.nef' 2>/dev/null | awk -F '/'   'seen[$(NF-1)]++ == 0 { print $(NF-1) }'
    This will print just one occurrence of directory
    The 'find' command files ALL *.nef files under your home directory (aka Folder)
    The 2>/dev/null throws away any error messages from things like "permissions denied" on a protected file or directory
    The 'awk' command extracts the parent directory and keeps track of whether it has displayed that directory before
    -F '/' tells awk to split fields using the / character
    NF is an awk variable that contains the number of fields in the current record
    NF-1 specifies the parent directory field, as in the last field is the file name and minus one if the parent directory
    $(NF-1) extracts the parent directory
    seen[] is a context addressable array variable (I choose the name 'seen'). That means I can use text strings as lookup keys.  The array is dynamic, so the first time I reference an element, if it doesn't exist, it is created with a nul value.
    seen[$(NF-1)] accesses the array element associated with the parent directory.
    seen[$(NF-1)]++ The ++ increments the element stored in the array associated with the parent directory key AFTER the value has been fetched for processing.  That is to say the original value is preserved (short term) and the value in the array is incremented by 1 for the next time it is accessed.
    the == 0 compares the fetched value (which occurred before it was incremented) against 0.  The first time a unique parent directory is used to access the array, a new element will be created and its value will be returned as 0 for the seen[$(NF-1)] == 0 comparison.
    On the first usage of a unique parent directory the comparison will be TRUE, so the { print $(NF-1) } action will be performed.
    After the first use of a unique parent directory name, the seen[$(NF-1)] access will return a value greater than 0, so the comparison will be FALSE and thus the { print $(NF-1)] } action will NOT be performed.
    Thus we get just one unique parent directory name no matter how many *.nef files are found.  Of course you get only one unique name, even if there are several same named sub-directories but in different paths
    You could put this into an Automator workflow using the "Run Shell Script" actions.

  • Set Folder Name From File Name Inclosed.

    Hello scripters,
    There has been quite a few topics about setting file names from parent folders. I believe it's possible but not sure how to reverse this process. That is to say set the folder name from a file in the folder. This is what I'm imagining.
    I've got a folder. In the folder are 100 folders with the names "untitled folder xxx" In side I've got files that are all named and numbered.
    For example,
    untitled folder/B-day 001~050.jpg
    untitled folder 50/At The Park 001~020.jpg
    I would like a script to change the name of the parent folder of the files that it houses.
    So untitled folder becomes
    B-Day
    untitled folder 50 becomes
    At The Park
    etc…
    I think getting the name of the first file (minus the index number) would be easiest.
    Any help or futher questions are greatly appreciated.
    Maximilian

    Working backwards...
    Assuming all the files have the same name structure (e.g. end in the format "xxx~xxx.jpg" you can get the base name using:
    <pre class=command>set baseName to characters 1 through -13 of filename as text</pre>
    This cuts off the last 12 characters of the file name.
    Once you have a folder, you can get the names of files in the folder via the Finder. for sanity's sake I'd ask the Finder for the first item, just in case there's more than one file:
    <pre class=command>set filname to name of first item of (files of folder theFolder)</pre>
    And if all the folders are in one top folder, you can iterate through them like:
    <pre class=command>repeat with eachFolder in (every folder of folder topFolder)</pre>
    So now, string it all together:
    <pre class=command>tell application "Finder" -- we'll use the Finder to do the legwork
    set topFolder to (choose folder with prompt "Choose the top level folder" ) -- get the top folder
    repeat with eachFolder in (every folder of folder topFolder)
    set fileName to name of first file of (files of folder topFolder)
    set baseName to characters 1 through -13 of fileName as text
    set name of folder eachFolder to baseName
    end repeat
    end tell</pre>
    Note there's no error checking - the script will fail if there are no files in any particular folder, but it should get you going.

  • Can't delete Apple folder in Common Files

    I went to the Genius Bar today.  They were not able to solve my problem but they did a full restart of my iPod and told me to reinstall iTunes on my home computer.
    Before reinstalling iTunes, I followed Apple's instructions for deleting all Apple software on my computer (Windows 7).  However, I have been unable to delete the Apple folder in the Common Files folder.
    I searched for hours online for solutions to deleting this file.  It looks like several people have had this problem and several suggestions have been made  but nothing has worked for me. 
    Among the things I have tried are stopping and restarting explorer.exe.  I also downloaded Byetunes but it looks like I can only delete one file at a time and there must be hundreds of files in this folder.  This is madness.
    I would deeply appreciate as complete a list as possible of ways to delete this file. 
    It should not be this hard to find out how to delete a file!
    Thank you.

    Followed the procedures as layed out in Apple Support online, but now I still can't delete the "Apple" folder in "Common Files" (during the 'verifying you've actually deleted iTunes' step...).
    Do you have the iCloud control panel currently installed? If so, try uninstalling that. Can you do the deletion now?

  • I am trying to install itunes 10.5 but I get an error message that says click ok to try again or enter an alternate path to a folder containing the installation package iTunes.msi...I try to point iTunes to the .msi file but that is not working.

    i am trying to install itunes 10.5 but I get an error message that says "click ok to try again or enter an alternate path to a folder containing the installation package iTunes.msi..." I try to point iTunes to the .msi file on my c drive but then it gives me  a message says "the file location is not a valid installation packaage for the product iTuness.  Try to find the installation package 'itunes.msi' in a folder from which you can install iTunes".  Any help, insight, guidance would be greatly appreciated!!

    "The feature you are trying to use in on a network resource that is unavailable. Enter alternate path to a folder containing the installation package itunes64.msi".
    Download the Windows Installer CleanUp utility from the following page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    To install the utility, doubleclick the msicuu2.exe file you downloaded.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • Attempting to upgarde itunes and I get an error message looking for "an alternate path to a folder containing 'iTunes.msi' location.  I've searched my hard drive and the file doesn't exist.  What to do?

    Attempting to upgarde itunes and I get an error message looking for "an alternate path to a folder containing 'iTunes.msi' location.  I've searched my hard drive and the file doesn't exist.  What to do?

    This worked...found on a prior discussion:
    Download the Windows Installer CleanUp utility from the following page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page)...
    http://majorgeeks.com/download.php?det=4459
    From the link above (near the top of the page)....Under 'download locations'   click on 'download@majorgeeks'
    To install the utility, doubleclick the msicuu2.exe file you just downloaded and ran.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    Restart your computer.
    Re-download Itunes (latest version form Itunes website) and install.  It worked!

  • How can i get the path to config folder placed inside the jar file?

    Hi i have developed an RCP application using eclipse.
    In my application config directory is there.
    When i export my RCP application as JNLP Project the jar file is created which contains config folder inside it.
    When i download the application using java web start , how can i get the path to config folder placed inside the jar file?
    Will the config folder exists in local cache in my system?
    Help needed.
    -Deepak

    -- This works in CS6:
    tell application "Adobe InDesign CS6"
      set myDocument to active document
      set selectedRectangles to selection of myDocument
      set theGraphicsLink to file path of item link of (graphic 1 of (item 1 of selectedRectangles))
    --> "Macintosh HD:folder/folder/filename.tif"
    end tell

  • Get name of the folder after parent.

    Hi forum.
    I need a great help from you.
    If I could get the name of the folder which is between the Desktop and the indesign files where it ls saved...
    eg.
    /Users/wleastudio/Desktop/rantac/acb.indd.
    I need to get the folder name highlited in red and alert...
    if this is straight away on desktop i can do alert easily like below..
    name = Folder("/Users/wleastudio/Desktop/");
    if(app.activeDocument.filePath == name.path+"/" + name.name) {
        alert ("The document is in Desktop"), exit;
    if, the document is saved inside a folder on a desktop, that's the problem, i'm finding to difficult to find folder name and get alert..
    /Users/wleastudio/Desktop/rantac/acb.indd.
    Many thanks in advance

    Hi,
    Many many apologies for the delayed reponses...
    Your help support me a lot!!!.. but,
    try {
    if(app.activeDocument.filePath.parent.parent.parent.parent.parent.pare nt.name =="Desktop") {
        alert ("Correct Location " + app.activeDocument.filePath);
    else {
    alert("the Job is wrong Location"  +"\r" +"currently here it is" + app.activeDocument.filePath)
    }} catch (e) {}
    When the parent folder name is mentioned" the script catches and alerts.
    if the "indesign doc" is not in the parent folder. i.e. it may be inside the folder on the desktop or download folder of some other folder...
    The alert says"null folder" not found.
    Many thanks

  • When I try to update itunes, I get the following:  The feature you are trying to use is on a network resource that is unavailable.  Click OK to try again, or enter an alternate path to a folder containing the installation package iTunes64.msi in the box..

    When I try to update itunes, I get the following:  The feature you are trying to use is on a network resource that is unavailable.  Click OK to try again, or enter an alternate path to a folder containing the installation package iTunes64.msi in the box below.
    This leads me to another dialog box that says:  The file .......is not a valid installation package for the product iTunes.  Try to find the installation package iTunes64.msi in a folder from which you can install iTunes.
    That doesn't work either.  What to do?
    Dean

    Download the Windows Installer CleanUp utility from the following page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    To install the utility, doubleclick the msicuu2.exe file you downloaded.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

Maybe you are looking for

  • Error when uploading a template

    Hello all, Environment: Oracle Apex - 4.0 (EPG) and Oracle 11G. I have configured print setup in Apex to work with BI Publisher. I have created an rtf file and trying to upload that rtf file and keep getting the following error message and I am unabl

  • Cl_gui_alv_grid

    Dear Expert, I am developing a report with cl_gui_alv_grid. After show the total data of material , use can double click on the plant to get the detail data of the material number. I set it with call screen 100 and in screen 100 I create a container

  • Dell's business pract

    i don't knowif you guys knew this.... but aparently a lot of the parts that dell include in their so called high end PC isn't so high end at all. first of all... they claim their machines are equipped with certain hardware, onl if you look deep into

  • How can I select the existing worksheet while using OLE2 to open the template workboo

    Source: application:=ole2.create_obj('Excel.Application'); workbooks:=ole2.get_obj_property(application,'Workbooks'); args := ole2.create_arglist; ole2.add_arg(args, 'c:\RptTemplate.xlt'); workbook:=ole2.invoke_obj(workbooks,'Open',args); ole2.destro

  • Context Menus In ListView Windows Phone 8.1

    Hi there, I'm in the process of porting my Win 8 app to WP 8.1, and one of the things I'm having trouble with is handling selection and context menus in ListViews In WP you use the context menu (hold and press to bring up a menuFlyout), but there doe