Script to find files with same names with in a folder and it sub folders.

Looking for script to find files with same names with in a folder and it sub folders.

Are you just looking to find if any two files underneath a folder have the same name?
If you just want to know that a file named "whatever" exists in two folders, that's not too difficult, but you probably want to know the full path names.
Here's one attempt:
$ perl -MFile::Find -le 'find(\&w, "."); while (($n,$p)=each %file) {if(@{$p}>1){print join(" ",@{$p})}} sub w{push @{$file{$_}},$File::Find::name;}'That will print the pathnames on the same line of any files with the same name that appear anywhere underneath your current directory.
It's a bit long for a "one-liner", but functional.
Darren

Similar Messages

  • Spotlight does not find files with "_" (underscores), but only for certain file types

    Hey Folks,
    this is strange, maybe someone has an idea.
    I already searched the internet for a while, nothing found so far.
    I have a file "calc_mean.m" on my desktop.
    When I type "calc" in spotlight, it shows the file.
    But when I type "calc_" it suddenly does not show the file anymore. Nor does find the file, when I enter "calc_mean.m" in spotlight.
    When I enter "calc mean.m" in spotlight, it finds it (using space instead of the underscore).
    Now comes the real surprise:
    When I rename the file to "calc_mean.txt", spotlight suddenly DOES find the file when entering "calc_mean.txt".
    I recreated this "feature" with other files, copying and renaming ".txt" files to ".m" files, and if there's a underscore in the file, spotlight wont find it.
    Playing around a bit more, it seems spotlight does find files with underscore when they are documents, at least it works for the following extensions:
    .pdf
    .doc
    .txt
    .xls
    But these extensions for example do not work:
    .mp3
    .m
    .k
    .a
    .ka
    (and other random endings I tried).
    I am pretty confused. Sure it's no big deal learning to search for files that include underscores in their name using space instead. But I'm still quite puzzled. Any idea?

    All of those have meaning in various database search syntax (not sure if it matters).
    _ usually means any character.
    % usually means any run of characters.
    - is often used to negate what comes next, i.e. "don't include results that have the following text."
    I don't see any problem on my Mac, though.
    I also don't have any problem finding file names with those accented characters using Spotlight. I would suggest reindexing Spotlight, but if cmd-f finds them, I'm not sure that would help.
    Spotlight: How to re-index folders or volumes

  • What are the pros and cons of using people keywords, given that my catalogue is already uptodate with regular keywording of all subjects?  e.g., will the people keyword transfer to other programs?, can I use the same name for a people keyword and regular

    What are the pros and cons of using people keywords, given that my catalog is already up to date with regular keywording of all subjects?  e.g., will the people keyword transfer to other programs?, can I use the same name for a people keyword and regular keyword in the same photo?

    What are the pros and cons of using people keywords, given that my catalog is already up to date with regular keywording of all subjects?  e.g., will the people keyword transfer to other programs?, can I use the same name for a people keyword and regular keyword in the same photo?

  • I have CS2. I shot RAW files with my Nikon D90 and now cannot open them in PS.  I heard there was a plug-in to download for this, but cannot find it. Help?

    I have CS2. I shot RAW files with my Nikon D90 and now cannot open them in PS.  I heard there was a plug-in to download for this, but cannot find it. Help?

    You would need at least CS3 with ACR 4.6 to natively edit NEFs from a D90 in PS:
    http://helpx.adobe.com/creative-suite/kb/camera-raw-plug-supported-cameras.html
    It might also work to use the DNG Converter 4.6 or newer to convert the NEF files to DNGs and then those might open in your older CS2 ACR, but I’m not sure, since it’s a 9 year old program I haven’t used in years.
    The DNG Converter can be found, here:
    http://www.adobe.com/downloads/updates.html

  • Spotlight fails to find files with search items

    I just did a Spotlight search on
    Japanese English は
    Spotlight found more than 3500 items, but the two sample Word files I looked at didn't have は in them.
    This is really frustrating. Is there a way to ensure Spotlight only finds files with the input?

    Spotlight is notorious for its weaknesses and erratic behavior. You might try reindexing your Spotlight. Open up Spotlight in Sys Prefs, go to Privacy and drag the HD Folder there. Leave it a minute then remove it by clicking on the minus at the bottom. This will force Spotlight to reindex the drive, which may take some time.
    I mostly use EasyFind (free) instead of Spotlight.
    http://www.devon-technologies.com/products/freeware/

  • Applescript: Create a Folder from Files of Same Name but different Extension

    Hi guys,
    Racking my brain for the past 2 hours trying to figure out how to properly use Applescript but alas to no avail.
    My  problem is as follows.
    xxxxxxx.extension1
    xxxxxxx.extension2
    yyyyyyy.extension1
    yyyyyyy.extension2
    zzzzzzz.extension1
    zzzzzzz.extension2
    I've been trying to create an applescript that takes files of same name and create a folder with the name of those files grabbed.
    So ultimately it would look like
    xxxxxxx/
         xxxxxxx.extension1
         xxxxxxx.extension2
    yyyyyyy/
         yyyyyyy.extension1
         yyyyyyy.extension2
    zzzzzzz/
         zzzzzzz.extension1
         zzzzzzz.extension2
    Can some more more adept at this than me provide with a solution?  It would be great if I could use by just selecting the folder that contains all these files.
    Also can anyone suggest an beginner's book on Applescript?  I'm a bit or an order freak and Im sure applescripting could help me automate a lot of repetitive tasks Im currently doing.
    Thanks!

    This will do what you need.
    set source to (((path to desktop folder) as text) & "Test") as alias
    tell application "System Events"
                   set fnames to (name of every file of source)
    end tell
    set AppleScript's text item delimiters to "."
    repeat with fname in fnames
              try
                   set folderName to text item 1 of fname
                   if folderName is not "" then
                    tell application "Finder"
                      if not (exists (folder folderName of source)) then
                          make new folder at source with properties {name:folderName}
                      end if
                     move file fname of folder source to folder folderName of source
                 end tell
           end if
        end try
    end repeat
    (the code formatting here really s*?ks. select all the text in the box and right click and select services make new AppleScript to get it into the editor)
    It's not very polished so be careful, setup some test folders and make sure it does what you want before using it on your live data.
    You need to set the
    set source to
    line to the path of the folder where the files are. You can do that as an absolute path ie "Macintosh HD:Users:etc" or using the path to as in the example.
    It is also not very efficient and there are many different ways to attack this problem. If this is a one time thing this will be fine. If it will be an ongoing situation you might want to describe exactly what is happening and other ways to solve the problem might be possible.
    As for learning AppleScript start with the Apple Development Site, especially AppleScript Language Guide.
    There are lots of sites out there with good info MacScripter being one of the better ones.
    Book wise I really like Learn AppleScript by Apress. Its good as both a tutorial and reference and has a good intro to AppleScript Objective-C (a way Apple ahs setup to allow AppleScripts to access pure objective-c code and the OS X GUI).
    good luck

  • Problem opening files with Mac OS Mavericks and Elements

    I have recently installed Mac OS 10.9.x Mavericks.  Since this I have had problems opening files in Elements 11.  I upgraded to Elements 12, blindly hoping the problem would fix itself, however it hasn't.   When I try to open a file the Finder window pops up then disappears immediately.  Occasionally it will stay open until I scroll down but then closes.   I keep the files on an external drive but the drive is working with all other applications, so I don't think it is that.  If anyone has had a similar problem and has any ideas I would be grateful as the program is unusable for now.  Thanks very much in anticipation

    Hi Sjmitc, I followed Barbara's instructions about only about 24 hours ago and since then my files have been opening perfectly.  I tried it again before replying to you and they are still opening fine.
    I did have to go through my files a couple of times to find all the Elements preferences, but the solution is working fine so far.  I will let you know if I have any further problems.  It is maddening when it happens, so I hope you can fix yours.
    Best of Luck 
    Date: Wed, 6 Nov 2013 18:23:28 -0800
    From: [email protected]
    To: [email protected]
    Subject: Problem opening files with Mac OS Mavericks and Elements
        Re: Problem opening files with Mac OS Mavericks and Elements
        created by sjmitc in Photoshop Elements - View the full discussion
    Henwen, Is this solution still working for you? I tried this same solution on mine a few days ago and had no luck. However, it actually let me open files this afternoon then when I went back in later today, it was doing the disappearing act again.
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5821793#5821793
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5821793#5821793
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5821793#5821793. In the Actions box on the right, click the Stop Email Notifications link.
               Start a new discussion in Photoshop Elements at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • I started to learn HTML, and I'm using text edit and everything is going fine, when I save the file with a .html extension and open it with safari I only view the code and not the webpage that was supposed to be created.

    I started to learn HTML, and I'm using text edit and everything is going fine, when I save the file with a .html extension and open it with safari I only view the code and not the webpage that was supposed to be created.

    That is because you don't have a web server configured and running to serve the html page. In order to see the page in a browser you need to access it using a url similar to http://localhost/~yourUserName if you are serving the page from your user account.
    Prior to Mountain Lion you could go into web sharing and turn on the web server. With Mountain Lion there is no option, other than using terminal, to turn on the web server. The web sharing menu item has been removed in Mountain Lion. Apache is still on your computer but it will take a little searching these forums or the Internet to find how to turn it on.
    If you want a graphic user interface to turn on/off the Apache server you could download and install a server application like xampp, http://www.apachefriends.org/en/xampp.html. I use this and it works well.

  • I can't open NEF files with PS Elements9 (Mac) and have just performed all avail. updates

    I can't open NEF files with PS Elements9 (Mac) and have just performed all avail. updates.  What to do?

    Many thanks!!!  This works and is probably the best fix for now.  Thank you!!!
    Date: Wed, 30 Jan 2013 10:58:01 -0800
    From: [email protected]
    To: [email protected]
    Subject: I can't open NEF files with PS Elements9 (Mac) and have just performed all avail. updates
        Re: I can't open NEF files with PS Elements9 (Mac) and have just performed all avail. updates
        created by 99jon in Photoshop Elements - View the full discussion
    For the D600 NEF's you have two alternatives: (1) Upgrade to PSE 11. (2) Download and install the free Adobe DNG converter to convert your raw files to the Adobe universal Raw format and the files will open in all versions of PSE (keep your originals as backups and for use in the camera manufactures software)  Windows download click here DNG Converter 7.3  Mac download click here DNG Converter 7.3  You can convert a whole folder of raw images in one click. See this quick video tutorial: You Tube click here for DNG Converter tutorial
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5034913#5034913
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5034913#5034913
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5034913#5034913. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Photoshop Elements by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Re: to create outbound file with multiple header ,detail and trailor in informatica

    Dear Mohan Prakash, Please mentation The Target Which Format you need. Please let me know. Thanks & RegardsKasireddy+966545281845

    hi I want to create a file with muiltple header detail and trailorSample of my file  1F99500094959                    5F99000000999911025F99000000999912025F99000000999913029F99500094959                    1G83341002729803                5G83000000999918020109G83341002729803                1G83910377940                    5G830000009999190201011050003522029G83910377940                    T20110720000000900000006750{  In this file 1 is header and 5 is detail and 9 is trailer and in last T segment is also trailerI have any idea to create seperate 3 files and in lastconcatenate all file with the help of unixbut in my case data is so large (in millions) this approach is not use full please suggest my any ideaHow to create VSAM file

  • What does it mean when you computer crashes and when you turn it back on it shows you a blank blue screen with a little folder and a question mark in the middle?

    What does it mean when you computer crashes and when you turn it back on it shows you a blank blue screen with a little folder and a question mark in the middle? It's a old imac from 1997.

    I don't have original discs that it came with.
    Then you still can use the second option with the keyboard combo I posted, called "resetting the PRAM."
    Also when you way hold the c key down do you mean turn computer off and turn back on holding the c key?
    Yes, or you can simply restart. As you don't have the CDs, this isn't on the plate any more.
    The internal backup battery is not expensive and, in most iMacs is user-replacable. If yours has a tray-loading optical drive like this one:
    it takes a major teardown to replace the internal battery. If this is the case, you'd be better off to leave the computer plugged in all the time; that eliminates the main reason for having a working battery.
    If it has a slot-loading optical drive like this one:
    things are much easier. The battery is visible through the RAM access door on the bottom of the computer case. The manual:
    http://manuals.info.apple.com/en_US/iMacG3_2000UserManual.PDF
    has sketches of how to access the RAM and therefore the backup battery. Unfortunately, the pdf on the manual goes up sideways on-screen and the RAM instructions are pretty deep into the manual. It's probably easier to scroll (for a while) to the section on adding RAM and print the applicable pages.
    When you work on the battery, some sort of non-conductive pliers or large tweezer or forceps help unless you have tiny fingers. Make sure to note the polarity of the old battery and install the new one in the same orientation.
    The battery itself is readily available. If price is no oblect, you can get it for a small rasom from Radio Shack Store ("Tandy" outside the US) as part number 23-026.
    Online, they are dirt-cheap even after adding shipping. I buy backup batteries form this outfit:
    3.6v Newer Technology Lithium 1/2 AA PRAM Computer Clock Battery

  • Hi i have just completed an imovie project and tried to save a hard copy on the desktop so i dragged the project file from the home page then movies folder and now the prioject seems to be lost , how can i get it back ?

    hi i have just completed an imovie project and tried to save a hard copy on the desktop so i dragged the project file from the home page then movies folder and now the prioject seems to be lost , how can i get it back ?

    It's a Finder feature, related to Quick Look. You can hit the space bar in the file list to get a preview.
    If that doesn't work, you may have an issue witha  preference file or similar. I find rebuilding the launch databse works quite well resilving tis kind of thing, as does trashing Finder preferences

  • Trying to write an Automator program to find files with same time created and change file names to matching source folder names

    I am failrly green when it comes to automator.
    I am trying to write an Automator program:
    Not sure where to post this
    trying to write an Automator program to find files and alter their names
    I have a source folder with correct named master files in it.
    eg. A0001_1234.mpeg
    time created 14:02:03
    date 07/07/2012
    Another folder where there will be copies of the master files in a different format with different names but created at the same time as a file in the source directory.
    they are created with a seperate device but they are
    A0000001.mp4
    time created 14:02:03
    date 07/07/2012
    I need it to then take the name from the source fies and apply the correct name to the matching file based on the time it was created.
    I can't seem to find actions in automator that reference time crated.
    Is this something I will be able to Do in automator?
    Any help would be great
    Thanks
    R

    Hi,
    It's impossible to do this without any script in Automator.
    Use this AppleScript script :
    set source to choose folder with prompt "Select the source folder"
    set anotherfolder to choose folder with prompt "Choose the another folder"
    tell application "Finder"
        repeat with tfile in (get files of source)
            set cDate to creation date of tfile
            set findFiles to (files of anotherfolder whose creation date is cDate)
            if findFiles is not {} then
                set tName to name of tfile
                set name of item 1 of findFiles to tName
            end if
        end repeat
    end tell

  • How can I do the same as Windows Explorer with datemodified:11/6/2013 .. 11/13/2013 showing only changed files with path in tree and NOT every folder along the way as Finder seems to do by default? Thanks!

    I'm an Apple newbie.
    I'd like to be able to list each file in the "Desktop" tree (ie; on the desktop, or in any folder on the desktop, etc.), along with its path, that has been modified since a certain date.
    When I use Finder to do a similar search, I get tons of output including every folder in the path to the modified file, etc. Although I can view the path to the individual files in the output, I can't for example, order the output by path, etc.  Very difficult to sort through. I'd love to have output like the example above - just the filename and path for each changed file.  Possible?  Thanks in advance!
    Wayne

    The file structure is a little complex. I will use inbox as an example.
    Inbox (a large file with no file extension)
    Inbox.msf ( An index of inbox with tags etc. Can be deleted with only loss of tags)
    Inbox.sdb (a folder, indicating that the folder within Thunderbird has a sub folder.
    POP mail is stored in
    Appdata/Roaming/Thunderbird/Profiles/*.default/Mail/[Server name]/
    Local folder is stored in
    Appdata/Roaming/Thunderbird/Profiles/*.default/Mail/Local Folders/
    As long as you do not overwrite, you can copy and paste whole folder trees into local folders (stuff on your old computer under a mail account is best relocated to local folder and then sorted as necessary afterwards.
    Note that you should delete foldertree.json after making those sorts of copies (it forces a full refresh of the folder tree, no cache) and under no circumstances copy data with Thunderbird running. It can irrevocably corrupt things

  • Finding file with tomorrow's date in file name

    I have a workflow where pdf files are going through a process and they could end up in an error folder.  The files all have the day's date embedded in their names.  I would like to set up a cron job looking for files that have dropped in an error folder with tomorrow's date on them.  Looking for today's date is trivial:
    find . -name *_`date +%m%d`_*.pdf | grep "Error"
    And I have a cron job that runs after midnight looking for files and it will send me an email.  But most of the time the files have been in the Error directory for hours/days before -- how do I look for tomorrow-dated files the night before so that I can deal with them before I go to bed?
    -- edited to add:  I am running SL 10.6.8  I don't seem to have gnuDate which would let me do the --date="1 day" thingy -- or maybe it is there and I don't understand how to embed it in the find command...

    Well, once again, a whole morning of diligent searching doesn't get the answer, but the minute I hit post on the question, I find it.
    find . -name *_`date -v+1d +%m%d`_*.pdf | grep "Error"
    Well, hope this helps somebody else!

Maybe you are looking for