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.

Similar Messages

  • How can I get an item that has the broadcast icon next to it into MP3 format so I can put it on my ipod nano?

    Question: how can I get an item in my itunes library, on my mac os 10.6.7 that has a broadcast icon next to it into MP3 format so I can play it on my ipod? right now it won't let me, and it's very frustrating!!!! thanks

    I might have misunderstood what you mean by the "broadcast icon," but if you are talking about an audio stream, then there is just no way you can convert a stream to MP3. What this would involve is either recording the stream, and then you would just be replaying the recorded audio on your iPod (is this what you are trying to achieve?), or reading the stream directly on your iPod, which an iPod nano does not support (it would need wireless connectivity).
    Hope this helps

  • How can I create a button that performs the function of a keyboard shortcut, specifically print scrn

    I need my presentation users to take a screen shot of a slide within my presentation.  I know that windows 8 has a new function that allows a screen shot to be taken and saved directly to the user's computer and I need a button that can be placed on a slide and perform this function.  The shortcut is (windows key) + (print scrn).  I want to save my userss some time and just have a button perform this task.  Any idea on how I can make this possible? I am using Captivate 7.

    I think Ajit may have misunderstood your need.  The command he told you about triggers the Print command to allow you to print the currently active slide (on a laser or inkjet printer). This does not have the same result as you would get by hitting the PrintScreen button on your keyboard (to take a screencapture and have it saved to the Clipboard for pasting somewhere else).
    You can add a button to your slide and set the PrintScreen key as the shortcut, but this will NOT mean that clicking the button will cause a screencapture to be taken.
    There are JavaScript libraries that will allow you to execute JavaScript code in a Captivate project that can take a screen capture:
    https://github.com/ariya/phantomjs/wiki/Screen-Capture
    However, to implement these solutions you would need to be quite knowledgeable with setting up JavaScript.  It's not for newbies.

  • Mail, how can you remove an image that shows up in the header?

    I have no idea how this image got where it is, but I would like to remove it. When I open Mail, I see in the address area of the email as it displays in the message viewer, to the very right of that area, there is an image, that I have no idea how it got there or how to remove. The following is a link (I think) Mail/Users/alaska_juliens/Desktop/Picture 7.png ...... that shows what I am talking about. I have gone through my signatures and made sure that image isn't in there and it isn't. Please help, it is driving my husband nuts, we would love to change the image to his company logo if possible, but we don't know if that image even shows up when others receive email from us or not (we email ourselves and it is right there in the address header of the email). Thank you for your time and help.
    Mail/Users/alaska_juliens/Desktop/Picture 7.png

    Typically what shows up there is the address book picture for that contact. If they attach an image it will be added to the address book.
    So go to the contact in address book and change or delete the image.

  • How can I "lock" my ipad but still use my PDF. I don't want anyone going outside of the PDF.

    I'm looking for a way to lock my PDF so consumers can't leave the app.... How can I do this?

    Not possible.

  • How can I get a banner that stays the same?

    I basically want to have a banner on my website like the adobe one at the top of this very site. Where however far you scroll out it can always be seen. I also want to know how to do this with my background image. I know how to stop it from scrolling just not scalling. Thanks, for your help!!

    CSS:
    body  {
    background: #000 url(your-BG-image.jpg) no-repeat center center fixed;
    /**for Safari,Chrome**/
    -webkit-background-size: cover;
    /**for Firefox** /
    -moz-background-size: cover;
    /**for Opera**/
    -o-background-size: cover;
    /**for other browsers**/
    background-size: cover;
    Nancy O.

  • How can I save a picture that shows as a "Firefox Document" type as a jpg so that I can see the picture and not the code?

    Many times, when I find a picture on Firefox, I want to save it to a file, but I'm offered the options of saving as a "Firefox Document" or "all files." Whatever I pick, when I try to open the picture, I only find code not the picture.

    You are trying to download what you think is a picture, but are really code appearing as pictures on the page you are viewing.
    This is often done to protect the copywrite of the picture.
    If you right click the picture in question and the dialog box includes Save Image As then it is a picture you can download.

  • How can I disable an Alert that indicates:"The URL is not valid and cannot be loaded".

    This Alert frequently pops up even after I've accessed a valid URL site on Firefox. Sometimes it takes 2 or 3 clicks to close the Alert window.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Both my Apple TV as well as my iTunes does not show the option "TV Shows". How can I add this basic feature?, Both my Apple TV as well as my iTunes does not show the option "TV Shows". How can I add this basic feature?

    Guys, when opening up  Apple TV as well as my iTunes, the option for "TV Shows" does not show up.
    Any help appreciated.

    Welcome to the Apple Community.
    Are you in a location that has TV shows.

  • How Can I validate an Cust_Id that has nubers and letters within it

    I am trying to validate a cust_id that has both numbers and letter in it. like this 111A12345678. the valid letters to be imputed are A,C,D,E,G,Z how can I validate this so that when the fourth character is any other letter than the above, like this 111B12345678 it display an error message that A,C,D,E,G,Z are the only valid letter that can be imputed in the fourth character.
    Your help is greatly appreciated
    Thanks
    Hank

    I think Sergio was wondering what Db version, 10G will give you regexp, if you're running 9i then a sql exists may do it for you
    select 1
    from dual
    where substr(:cust_id_item,4,1) in ('A','C','D','E','G','Z')

  • How can I delete all of my contacts from my iphone? I have updated my contact list in Outlook, and need to re-import that "clean" list.

    How can I delete all of my contacts from my iphone? I have updated my contact list in Outlook, and need to re-import that "clean" list.

    There is a checkbox on the 'info' tab in iTunes that will allow you to overwrite the address book on the phone with the one from the computer on the next sync.

  • I want to sort all my bookmarks alphabetically but can't. You only let me drop a bookmark into an already-existing folder. And if that is the only way, how can I create new folders?

    Question
    I want to sort all my bookmarks alphabetically but can't. You only let me drop a bookmark into an already-existing folder. And if that is the only way, how can I create new folders so that I can try to create meaningful folders?

    With the iPod connected to the computer go to the Music pane for the iPod in iTunes and check the box that says sync only checked songs. The check the songs you want synced and click on Sync. For more info see:
    iTunes: Syncing media content to iOS devices and iPod

  • How can I Sync a folder (which contains all types files, sub folders and weighs some gigs) through wifi or USB ( and not using cloud services) between my New Ipad and Win 7 PC? Any apps available? Kindly help

    How can I Sync a folder (which contains all types files, sub folders and weighs some gigs) through wifi or USB ( and not using cloud services) between my New Ipad and Win 7 PC? Any apps available?
    kindly suggest a solution.
    Thank you inadvance!

    You can only import photos/videos via USB and the camera connection kit.
    ITunes: Syncing media content to your iOS devices
    http://support.apple.com/kb/ht1351
     Cheers, Tom

  • How can I list all the domains configured for Weblogic Servers?

    How can I list all the domains configured for Weblogic Servers?
    I saw a note, which says the following:
    "WebLogic Server does not support multi-domain interaction using either the Administration Console, the weblogic.Admin utility, or WebLogic Ant tasks. This restriction does not, however, explicitly preclude a user written Java application from accessing multiple domains simultaneously."
    In my case, I just want to list all the domains, is that possible by using any scripts?
    Thanks
    AJ

    If you use WLS Node Manager and the Config Wizard was used to create the domains, then the list of domains should be in a location like this:
    <MIDDLEWARE_HOME>\wlserver_10.3\common\nodemanager\nodemanager.domains
    Enterprise Manager Grid Control also has support for multi-domain management of WLS in a console.

  • How can I see all the Transaction Code that the client is using?

    How can I see all the List of Transaction Code that the client is using?

    Hello Sugauli,
    Did you mean to ask
    transaction types the client is using?
    instead of
    transaction code
    If so, go to SPRO (in ERP system) and follow this path:
    Sales and Distribution -->
         Sales -->
             Sales Documents -->
                 Sales Document Header -->
                      Define Sales Document Types
    All the transaction types that are not used have an X in the column Block.
    Easwar Ram
    http://www.parxlns.com

Maybe you are looking for

  • Default static route and Null 0

    Hi Everyone, Need to clear some doubts  for below setup Switch 3550A is connected to Internet Router and has OSPF nei relationship with it. 3550A#                      sh run int fa0/11 Building configuration... Current configuration : 272 bytes inte

  • DVD-RW not working properly

    Hello, I just want to be able to use my DVD-RW like a hard drive, like in windows. I'm new to mac, so maybe I'm missing something, but I simply dragged a file onto the RW, it copied to it, then I couldn't add anything else. I also have Toast if this

  • Not able to use Bluetooth with Mitsubishi Outlander (2014)

    I have a new iPhone 6 with iOS ver: 8.1.3 and I am able to pair the phone with the car (Bluetooth) system, Bluetooth says it's connected, but I am unable to make/receive calls using Bluetooth. On the phone it shows that it is connected via Bluetooth,

  • LR5 to LR3 import issues

    I outsourced some editing and when I tried to import the files from a LR5 program to my LR3 it said "DSC file not found or missing". I have tried deleting it all, creating a new catalog, adding scripts, finding missing files- all to no avail. The per

  • Photo streaming into Aperture

    Hi I have acquired an iphone 5. I have set it up to wirelessly transfer iphone photos to "photostream" in  A3. However I notice that photos I download from my regular camera via a card reader also go through to the Photostream. How can I prevent this