Comparing files in a folder

Not sure this is a Newbie Corner type question, but I did not see where else to go, so here it is...
Scenario: I have two seperate folders that contain a lot of files, some again in sub-folders. Now I need to find out which files happen to be in both folders, and they must be identical as well. I know how to run diff to compare two files, but that barely scratches the surface of what to do here, seeing as we talk about several dozen files in both folders, possibly even arranged in folders named differently.
I am looking for an elegant solution to this that goes beyond comparing them visually in dolphin.... Any hints?

"diff -qr dir1 dir2" works fine, except for special files like symlinks that point to nonexistent locations (I discovered this yesterday when checking my new arch copy...) diff will report that it can't open the file in such case.
I used meld to avoid this problem, but it used a lot of memory for some files and that made linux close all running programs, which was bad.
Edit: ah, if "possibly even arranged in folders named differently" means what I think it means, then davvil's solution is closer to what you need, yeah...
Last edited by stqn (2010-11-18 01:15:40)

Similar Messages

  • Comparing files in a folder with those in another folder with multiple subfolders

    is there a non-terminal tool that i can buy that will do the following?:
    i want to compare the files that are nicely sorted into nested sub-folders and sub-sub folder in /one/ folder with those that are sitting - in bulk - in another folder.
    effectively i want to then /delete/ the duplicated files in the /bulk/ folder and sort the remaining files - the ones that are not dupes - in with the files that are already sorted. i don't want to delete the files that i already filed obviously and I only want to add the files that are not dupes.
    i'm dealing with pdf's in this case.
    TIA

    hotwheels 22 wrote:
    i wonder if anyone has tried Araxis Merge?
    Merge for Mac is here
    <http://www.araxis.com/merge_mac/index.html>
    It does folder sync -- and there are quite a few other folder sync tools out there. But that's not what you asked.
    files that are nicely sorted into nested sub-folders and sub-sub folder […]
    sort the remaining files […] in with the files that are already sorted
    That's not folder sync'ing. I doubt you'll find an app which does that out-of-the-box.

  • Creating File objects from all files in a folder.

    Hi, I'm not too brilliant of a programmer, so this may be an obvious one that I could find in the API.
    My goal is to compare files for similarities and then give some output, that's not too important.
    My question is: How do I create an array of File objects from a folder of *.txt files, without creating each individually? Is there a way to simply get all the files from the folder?
    File I/O is still pretty new to me. If I didn't give a good enough explanation, please say so.
    Thank you very much!

    Note by the way that a File represents an abstract pathname, the idea of a file as a location. It doesn't specify the file's contents, nor does it require that the file it represents actually exists. A better name might be "theoretical file" or "directory listing entry".
    So getting a whole bunch of File objects is itself perhaps not necessary (although it could be useful).
    To expand on reply #1, look for File methods whose names start with "list".

  • Read all the files in a folder over and over again

    I want to develop an application that reads all the files in a folder, and once its done reading those files it reads all the files again.
    The purpose for this application is to read all the files in a folder that are continuously being stored in that folder, so that when a new file is created, that file is also read by the application. I then need to compare the date and time in which the file was created to the actual date and time of the system, so that way I can get the most recent file, and then  I will do other operations with this file.
    The thing is that I know how to read all the files in a directory, but I don't know how to cycle through those files again, in order to look for the most recent one, and I don't know how to make the comparison of the time stamps, because I need a precision of one second in the system time and the time the file was created.
    Can someone please help me?
    Thanks in advance!
    Solved!
    Go to Solution.

    I think that I just went the wrong direction.
    What I wanted to do in the first place, was to rename and overwrite every new file in a directory with the same name and file extension, so that every new file overwrites the old file. The thing is that the list folder only lists the files the first time and then keeps on telling me there are no files to be read even though there are new files.
    What I need now is a way to overwrite the old files with the same name, and keep searching for every new file that is going to be stored in the directory.
    I will leave the code that I have right now, so that you can tell me what do I need to modify in order to read every new file that's going to be created in that directory.
    Thanks in advance for your help!
    Attachments:
    Overwrite Files.vi ‏12 KB

  • Comparing files in two folders to find duplicates using part of file name

    I'm not sure if this is something Automator or perhaps Terminal can do, hoping someone might be able to offer guidance or suggestions.
    I have two folders filled with files of photographs.
    First folder has approx 15,000 files.
    Second folder has approx 1,200 files.
    I need to compare the files in the two folders and remove duplicates from the First folder. In other words, the 1,200 files in the Second folder are also in the First folder and they need to be removed from the First folder, leaving 15,000 - 1,200 = 13,800 files in the First folder.
    To add a wrinkle to the comparison (nothing is ever that easy), the file names are consistent between folders for the first 17 characters (files follow the format of my name_6 digit date_4 digit # sequence, ie nickB0904087110.jpg) but in the Second folder, the files will have an additional tag added to the file name (ie nickB090408_7110Final.jpg).
    Any suggestions or help much appreciated!
    nick

    Old post, sorry, but for the sake of trying to answer it:
    The method described here can accomplish the goal, as I understand it.
    http://texo.wordpress.com/2009/08/17/comparing-large-directories-fast-in-osx-or- linux/
    rsync -rvn --delete /FirstDirectory /SecondDirectory
    (He describes: The 'n' flag is a 'dry-run'; remove it and the files will be copied. And '--delete' deletes any files NOT in the FirstDirectory.)
    I found I needed to put slashes at the end of the directory name too. ... /Directory1/ /Directory2/
    That way it seems to compare those actual folders. Without the slashes, it just put a copy of Directory1 into Directory2. I'm sure there's something I don't understand about rsync though.

  • Sorting FIles in a Folder?

    Hi All,
    I want to sort all the files ( FIFO )which are available on a Folder and return them back as a List.
    Can anyone help me in this , I have serch in the forums but no solution to this problem, I know abt Comparator but some how its not helping me out.
    Thanks.

            Comparator<File> comparator = new Comparator<File>()
                public int compare(File left, File right)
                    return -1, 0 or +1 depending on how you want to order the files;
            File folder = ... ;
            File[] containedFiles = folder.listFiles();
            Arrays.sort(containedFiles, comparator);

  • Comparing file lists in separate folders on separate drives??

    I've got a large Final Cut Pro project. I've copied the media files from one folder on the master drive to another folder on the backup drive (as I've added them). Not an FCP backup per se, but simply a folder to folder copy.
    Dilemma. I've just copied hundreds of media files (Quicktime). The two folders are identical, except for a single file. There are almost 4,000 files in the folder ... so I don't have the courage to go through them file by file to discover the one that hasn't been copied.
    Is there a simple way to mirror the two folders so I can see which file hasn't been copied?
    Ben

    I've only used it to compare much smaller folders. I tried testing by comparing two user library folders (lots of files and folders there), but it didn't like that very much. BBEdit didn't have the same problem, so it looks like TextWrangler may be a bit stripped down for comparing large folders.
    It still took a while though, since it seems to also be comparing text files, so maybe doing the Unix thing from the Terminal would have been the way to go, for example:
    diff -rq --suppress-common-lines drag/one/folder/here drag/the/other/folder/here
    edit: that should be all one line - after the command, just drag the items from a Finder window to the Terminal's cursor location

  • Folder Compare Utility that Ignores folder hierarchy?

    Hi-
    I'm looking for a utility that compares the files in two different folders to flag differences... BUT ignores the folder hierarchy. For instance, in Folder A "instructions.doc" may by in a sub-folder called "Computer," but in Folder B it may be in a sub-folder called "Computer Stuff," so I wouldn't want it to be flagged. But if it weren't ANYWHERE in Folder B, I would want a notification.
    Does anyone know if such a utility exists?
    Thanks!

    Thanks to some help on another forum, this is how I did it:
    In Terminal, run:
    cd folderA
    find . > ~/foldera.txt
    cd folderB
    find . > ~/folderb.txt
    This will create textfiles in your home directory that list all files in each folder. The files are listed with their full paths, so now open the lists in a text editor (I used TextMate) and do a find-replace to remove the path information and leave just bare filenames - I used the regex expression \..*\/ I also then sorted each file alphabetically.
    Now you can compare the two file-lists in Terminal with diff:
    diff ~/foldera.txt ~/folderb.txt
    Or you can do the comparison with nicer visuals using the FileMerge utility that comes with the Developer Tools.
    There might be easier ways to do it, but this worked for me.
    HTH.

  • Can't compare files in VS 2012

    Hello,
    Randomly i can't compare files anymore in VS 2012 and only a restart of VS helps.
    The error message is:
    Microsoft Visual Studio
    One or both of these files are not text files and cannot be opened in the comparison window.
    C:\Users\wfuerst\AppData\Local\Temp\TFSTemp\vctmp23076_218344.sln
    C:\t\E\src\EFA_Integration\Solution\DefaultCustomer\DefaultCustomerSolution.sln
    The contents of the two files are different.
    OK  
    Whats wrong here and how can i fix this?
    Thanks,
    Wolfgang

    Same issue here. Can't find a pattern to reproduce but it occurs and only a VS2012 restart will let you compare any file again.
    I have VS2012 running against a TFS2012, TFS 2010 power tools installed.
    3. Can you open the files in notepad?
    YES, both
    4. Do you compare a local file and a server file?
    YES, Source path is filled out with the server location, Target path with the local
    5. Check the file in temp folder when you get this error.
    Checked, I can use winmerge effectively between the same 2 files VS is complaining about
    6. Is there any detail event log relate to this issue?
    No, couldn't find anything on the event logs

  • Slow access to DBF files on shared folder in Win7 Prof

    Hi,
    I've a LAN based on 5 XP workstations and one Win7x64 computer with shared folder. No firewall, no antivirus software on this machine. There are some DBF-files in this folder. DOS application is running on these 5 workstations. This application uses shared
    DBF-files. When I useed share folder based on XP-machine application worked normaly, access to these files was well rounded. After changing the "server" the access is never ending. Browsing/reading/writing data is a horror.
    Have you any ideas?
    Regards.

    Hi,
    Could you please tell more details regarding this sentence” After changing the "server"
    the access is never ending. Browsing/reading/writing data is a horror.”
    How does the DOS application work here?
    When we configured the application to access the DBF files on Windows 7, have we received any
    special errors?
    As the application worked well on the Windows XP workstation, might we consider to use process
    monitor to compare with the same process on Windows 7?
    Troubleshooting
    with Process Monitor
    Best regards
    Michael Shao
    TechNet Community Support

  • Removed some files from library folder

    moved files from library folder and attempted to put them back after experiencing major changes and problem. This is not correcting the situation what can be done to restore it back to what it was before I started?

    Hi Ali,
    Update, I did a verify permissions with disk utility and some stuff is where it should be now, (recovered iphoto yeah) but still a problem with other things as before.
    So to answer your questions,
    What is the exact path to this folder? And please post the contents of the folder.
    I get to her old itunes by the following path;
    home>music>itunes>itunes music - this folder contains folder icons of all her old itunes library, each artist has a folder, such as amy cook>list of albums>list of songs - if selected will than open itunes and will import to new itunes library.
    I don't quite understand the heirarchy you are describing. Please post the contents of her Home folder.
    Her home folder contains
    Desktop
    Documents
    Library
    Movies
    Music
    Pictures
    plus 9 folders she had created over the past four years these are intact and accessible to proper application programs (ie documents open in appleworks, pictures are from the pictures library not iphoto, 3rd party software such as genealogy programs are intact and up to date)
    "I find some old unchanged items such as itunes, imovie, email mailbox items, in a folder that she created before the change took place in her user
    account."
    What is the exact path to this folder?
    As for this folder some things were moved back to proper places with the above mentioned verify permissions, some like, mailbox items, I was able to import to current settings to restore to how it use to be. From what I gather she created this file when things were going wrong and she feared messing the whole thing up. I access this by the following path;
    home>library>(then the folder she created) Library do not touch.
    When I compare the main library file to my account main library file they do not contain the same items in fact many of the missing items seem to be in this folder that she created. I assume the ones I need are in this file she created but I am really hesitant to just start moving things around out of fear of creating more problems on her side or messing up my side.
    If you have sufficient available disk space, you shouldn't have any problem, but you need a reliable backup, just in case.
    In regards to archive/install - sufficient available disk space meaning as much or more than what I am currently using? How do I check this to be sure?
    Which brings me to a whole new question if you have time?
    We do have an external back up system, which we used before a semi-recent move, (I plan on finding the box it is packed in believe me), however we attempted to use imacs backup program to do a quicker backup, were able to back up her side onto disks, but when I attempted to do the same on my side I received an failure error screen something about a drained buffer and being unable to perform a backup. Please tell me I have not fried my dvd drive!!!
    Thanks again, hope I answered in a way that is helpful to you.
    need to know

  • Counting files in a folder and showing results in an alert window.

    Hello all.
    I would like to get the script to count the number of files in a selected folder.
    I have a UI where there are browse, ok and cancel buttons.
    I wanted the OK button to show the number of jpeg files in the selected folder. If no folder is selected, and the OK button is pressed, it would prompt the user to select a folder before pressing the OK button.
    Thanks!

    all you need to learn scripting is in the "JavaScript Tools Guide", you're making some progress but reading that and following the samples will make things clear and speed the learning proccess up.
    if you look at your code there's only one function, it is called when the Browse button is clicked. See how it is constructed and write another similar function for the Ok button, in there read the contents of the label box and create a folder with that path, then call the function to read the files.
    dlg.Panel1.okBtn.onClick = function (){
       selectedFolder = new Folder(decodeURI(dlg.Panel1.Path.text));
       if (selectedFolder.exists)
            doSomething (selectedFolder);
       else
            alert("select a folder first...");
    dlg.center(); //center dialog box on screen
    dlg.show(); //show dialog box
    function doSomething(folder)
            files = folder.getFiles();
            alert(files.length + " Files in selected Folder");
            alert(files);

  • Archiving  file in different folder in sender file adapter

    Hi,
    I have a requirement in witch i have to pick 7 different file from seven different folder.
    for this I am using advance selection tab and defining all the other folder path.
    but my problem is I have to archive the different file in different folder .
    For exm..
    /folder1/file1.txt need to be archive in /archive_filder1/file1.txt
    /folder2/file2.txt need to be archive in /archive_filder2/file2.txt
    /folder3/file3.txt need to be archive in /archive_filder3/file3.txt
    can any one tell me that how to  define the dynamic  archive folder path??.
    regards,
    Navneet

    Hi Navneet
    In File Access parameters --> Target Directory
    Use this type of Directory name
    \XIDEV_STORES\%store%\sapoutbound
    here %store% will be changed accordingly
    e.g. if file will come for store 001 then this %Store% will be replaced by 001 and file will be placed in this 001 folder and if file will come for store 002 then this %Store% will be replaced by 002 and file will be placed in this 002 folder over FTP.
    For to achieve this Go to Advanced tab 
    For Variable Substitution check mark Enable
    Now speciofy the parameter values for Variable Name and Reference
    Under Vriable name specify = store
    Under Reference specify = payload:WP_PLU02,1,IDOC,1,EDI_DC40,1,RCVPRN,1     -
    You have to give full path name here that where this store variable is located into IDOC.
    Hope this example will help you
    Regards
    Dheeraj Kumar

  • To Place the XML file from one folder to another folder in AL11

    Hi All,
      Here my requirement is to create the quotes using XML document. The XML document will come from the Application server. this one is fine.
    Now my prob is after processing the XML file, we have to place the XML file into another folder.
    Please let me know how to move the data inot XML file.
    Now iam reading the data into one variable V_string(it will contains the total XML file). From this variable how to move the data into APplication server.
    Please do the needful.
    Regards,
    Sreehari

    Hi,
    Use FM WS_FILE_COPY To FIrst Copy the File to some Location
    and Next Use FM TMP_GUI_DELETE_FILE To Delete the File from Old LOcation.
    Regards
    Bala.M

  • To relocate mail.log, mail.log_current file to specific folder

    Hi
    We have configured CommSuite 6 in single host. The output of “imsimta version”:
    Sun Java(tm) System Messaging Server 7.0-0.04 32bit (built Jun 20 2008)
    libimta.so 7.0-0.04 32bit (built 01:01:00, Jun 20 2008)
    Using /opt/sun/comms/messaging/config/imta.cnf
    SunOS mail 5.10 Generic_120012-14 i86pc i386 i86pc
    Output of imta_tailor file:
    IMTA_USER=mailsrv
    IMTA_USER_USERNAME=nobody
    IMTA_WORLD_GROUP=mail
    IMTA_LOG=/logs/messaging/imta
    IMTA_PRIMARY_LOG=/logs/messaging/imta/mail.log_current
    IMTA_SECONDARY_LOG=/logs/messaging/imta/mail.log_yesterday
    IMTA_TERTIARY_LOG=/logs/messaging/imta/mail.log
    We need to relocate mail.log, mail.log_current, mail.log_yesterday file to specific folder.
    After above setting we cannot be able to relocate above file.
    Pl. help us.
    Thanks
    P.K.

    world.group wrote:
    We have configured CommSuite 6 in single host. The output of &#147;imsimta version&#148;:Please note that CommSuite 6 update 1 is now available and it is advisable that you upgrade using the "commpkg upgrade" command.
    IMTA_LOG=/logs/messaging/imta
    IMTA_PRIMARY_LOG=/logs/messaging/imta/mail.log_current
    IMTA_SECONDARY_LOG=/logs/messaging/imta/mail.log_yesterday
    IMTA_TERTIARY_LOG=/logs/messaging/imta/mail.logThese parameters are now ignored as per the Messaging Server 7.0 release notes:
    http://wikis.sun.com/display/CommSuite6/Messaging+Server+7.0+Release+Notes#MessagingServer7.0ReleaseNotes-Ignoredimtatailorsettings
    We need to relocate mail.log, mail.log_current, mail.log_yesterday file to specific folder. You can relocate the MTA log directory through the use of symlinks.
    Regards,
    Shane.

Maybe you are looking for

  • Database link error when compiling forms 6.0 and forms 6i.

    Dear sirs, We have a database link between two databases of the same version oracle 8.0.5. Recently we have upgraded one of our databases to version 9.2.0.1 (the database where the database link was originally created ) and now we are having problems

  • Wireframe on display

    I have upgraded my iMac from 10.7.5 to Mavericks (10.9.4) I now have a wireframe on my display that follows my cursor. I have not found anything in System Preferences to turn it off. Can anyone help me to get rid of it?

  • Oracle 8.1.7 installation on Mandrake 8.1 (New)

    Has anybody tried installing ORACLE 8.1.7 on the new release Mandrake 8.1 distro? I did try to install but it freezes at start of installer, though it worked perfectly with the earlier distro (mandrake 8.0) any comments or suggestions ?

  • Photoshop CS4 "Freezes" when saving as a JPEG

    I have been using Photoshop CS4 with SnowLeopard and my MacPro for months now without a problem. I save multiple images everyday, often as JPEGs for the Web. But today, out of the blue with nothing changing (no new updates, or plugins), Photoshop "lo

  • Poor quality Video, picture pixelated using apple tv

    Hi, I can stream video like bbc iplayer using apple tv2, from my iPhone 3GS and my ipad2. Moving pictures ( video) tends to be very pixelated to fast the image the worse it is . Still photos are good and the sound is perfect.. Wifi is from BT with ro