Comparing contents of two folders

Is there a way to compare the files in two folders--a folder on my machine and a folder on a removable storage device such as a PC card--and output the names of the files that are missing from the folder on my machine?
My machine often drops files unexpectedly when I copy them from my PC card to hard drive and I want to be able to then find the 2 or 3 missing files (out of 500-800 images which I have copied) quickly.
Thanks.
Pedro Paramo

'Is there a way to compare the files in two folder ...' - Yes.
'... a folder on my machine and a folder on a removable storage device such as a PC card ...' - I have no idea what a PC card is (with exception to the former PCMCI card - renamed PC Card. Please do not explain). Perhaps you mean an external storage device - like a USB 'thumb' drive, etc.
'My machine often drops files unexpectedly when I copy them from my PC card to hard drive' - Welcome to MacOS X.
Sample source code:
property destFolder : ((((path to desktop folder from user domain) as string) & "Destination Folder:") as alias) -- Provide the appropriate full path to the destination folder.
property srcFolder : "Source Folder" -- Provide the name of the source Folder.
on run -- Exectued if user double clicks on applet. Display an appropriate message.
display dialog "Drag USB 'thumb' drive(s) onto this applet, for further processing." buttons {"OK"} default button 1 giving up after 5
eproperty destFolder : "Destination Folder2" -- Provide the appropriate full path to the destination folder.
property srcFolder : "Source Folder" -- Provide the name of the source Folder.
property destPath : ((((path to desktop folder from user domain) as string) & destFolder) as alias) -- Your full path to your 'destFolder' may vary. If so, edit this line accordingly.
on run -- Exectued if user double clicks on applet. Display an appropriate message.
display dialog "Drag USB 'thumb' drive(s) onto this applet, for further processing." buttons {"OK"} default button 1 giving up after 5
end run
on open (dItems) -- Executed if user drags an item or items onto the applet.
my process_Items(dItems) -- Process dragged on items.
end open
on process_Items(tItems)
tell application "Finder"
try -- Capture any AppleScript created error(s).
set destItems to displayed name of every file of destPath -- Names of files in 'destFolder'.
on error
set destItems to {} -- Set 'destItems' to empty list, if 'destPath' is empty.
end try
repeat with i in tItems
if ((kind of i) is "Volume") then -- Limit 'kind' of items to process.
set srcItems to (every file of (((i as string) & srcFolder) as alias)) -- Names of files in 'i's (an individual volume) 'srcFolder'.
repeat with j in srcItems -- Cycle through list of files in 'srcFolder'.
try -- Capture any AppleScript created error(s).
if (not (destItems contains (displayed name of j))) then duplicate j to destPath -- Duplicate files in 'srcFolder' not in 'destFolder'.
on error
if (destItems is {}) then duplicate j to destFolder -- Duplicate files in 'srcFolder' not in 'destFolder'.
end try
end repeat
end if
end repeat
end tell
end process_Items
Save the above code as an 'Application' (AppleScript applet).
Drag any volume or volumes onto the applet for processing.

Similar Messages

  • How can i compare the contents of two folders ?

    how can i compare the contents of two folders and find out which files are in one but not in the other?? Knowing how to do this would be the best thing ever, especially when dealing with a large number of files. Often, for instance, I'm dealing with a large number of images, processing them, and saving the retouched ones to a new folder, and need to check that they are all there. If there are say three files missing in the second folder (out of say a hundred in total) being able to automate the process of elimination would be very useful. Please help!!!
    B

    I really wish I knew the answer to this. I work between two macs, a G5 and MacBook Pro when I'm on the go. Each time I move from one to the other I have to copy all my files to the computer I'm going to work on, so I end up with the same files being duplicated. It's not a problem if it's not much data but in my case the it can be to 30GB, mostly graphics files, photoshop, motion, final cut pro, etc.
    There's has got to be a way automator can make a comparison between two folders to sort out what's changed and what's remained the same. It would be nice also if this feature could be done globally on the hard disk using spotlight's technology to stop files being duplicated in places you didn't even know about and taking up valuable disk space. I'm not sure how this could be done.
    Any bright ideas Apple?

  • How to Merge the Contents of Two Folders in Lion, Keeping the Newer Versions of Duplicate Files.

    Select and copy all the contents of the folder containing the newer files.  Paste the files ONTO the folder containing the older files.  The unique files will be copied into the older folder without further ado.  For the duplicates, a window will appear warning that a file with the same name already exists in the older folder.  Check the "Apply to All" box and click on the Replace button, not the Skip button.  These steps will merge all the files in the newer folder into the older folder, replacing the duplicates with the copies from the newer folder.
    Unfortunately, the only information that the warning window provides about the duplicates is their common name, not sizes, dates, or times.  These steps worked for me because I knew for certain that all the newer files were in one folder.

    Great, I just lost 10 GB of data thanks to OSX folder merge... because appaerantly I should have known better not to keep a subfolder inside my folder I was trying to merge
    I can not beleive more people don't have a problem with this. Merge contents in Lion does NOT merge contents if 1 or more of those supposed "contents" is a subfolder
    Merge contents of two folders only works for files, it does NOT work for subfolders!!!!
    Can we please get this acknowledged as a bug that needs fixing?
    EXAMPLE:
    Drive1 / Folder1
                   - text1.txt
                   - text2.txt
                   - / subfolder / text3.text
    MERGE TO
    Drive2 / Folder1
                   - text1.txt  (this gets updated / merged)
                   - text2.txt  (this gets updated / merged)
                   - / subfolder /
                             - text.txt
                             - text2.txt     (this should get text3.txt merged into it, from Drive1, but instead this subfolder is REPLACED, and NOT MERGED!!)
    Why would i want to replace a folder if I'm trying to merge it!?
    Almost 2013 and OSX still cant merge a folder? unbelievable

  • Function module for comparing contents of two internal tables

    Hi All,
    Is there any function module to compare contents of two internal tables of same structure?
    If yes please let me know.
    Thanks in advance.
    Amol

    Hi
    call SE16 with table TFTIT in order to get a full list (it will be long...)
    A list of FMs with parameters can be found in table FUNCT.
    Finally go to sm37rsdf4
    that will give you all the function modules with description
    Here is the list:
    http://www.erpgenie.com/abap/functions.htm
    hope this helps...
    Regards
    CSM Reddy

  • 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.

  • Script to Compare File Contents in Two Folders and List Differences?

    I've looked through the Forum but can't find anything that seems quite to address my problem--and I'm really new to AppleScript, so please forgive me if this is a dumb question.
    I burn a great many files of varying kinds (InDesign, Illustrator, Photoshop, PDF, etc.) to DVD everyday as part of my job. It happens not infrequently, though, that files drop out in the process and don't make it to the disk, with the result that I get calls from Manufacturing saying that I've screwed up and that random files X, Y, and Z are not on the disk that I sent.
    I've tried various ways to failproof my burning routine, but utlimately, it seems like something still slips through sometimes--that is, the files are definitely in by Source Folder, but sometimes they don't leap the chasm to the disk. And since there can be several hundred files, it can be difficult to know at a glance if something is wrong.
    It would be extremely helpful if there were a script that I could run to compare the contents of the folder source on my desktop (just say its called "Source Folder") with the contents of a disk I have just burned (whose name might vary, but whose folder structure is a duplicate of the subfolders in "Source Folder" that I have burned to disk. All I need the script to tell me is if there are files in my desktop Source Folder than are not on the burned disk).
    Is this possible? I'd appreciate any help anyone could offer--right now, I'm printing up the disk directory and a list of the files from my desktop Source Folder and comparing them line for line, and my soul is dying.
    Please help!

    This can be pretty easily hacked together using a combination of AppleScript and shell scripting.
    There's a shell command diff that can tell if two directories are the same or not. You can use AppleScript to put a nice front-end on it, like:
    set src to (choose folder with prompt "Select the source directory")
    set dst to (choose folder with prompt "Select the destination directory/disk")
    try
      do shell script "diff -rq " & quoted form of POSIX path of src & space & quoted form of POSIX path of dst
    on error theErr
      display dialog "The following differences were found:" & return & return & theErr
      return
    end try
    display dialog "Directories match. No differences found"
    It's quick and dirty, but should get you started. It runs the diff command which triggers the 'on error' code if there are any differences. The script then reports the differences and exits. If there are no differences the 'on error' code is skipped and you get the all clear message.

  • App that will compare contents of two large external drives?

    Hi-
    I have two external 1 TB drives. They are supposed to have identical content but don't. I would like to see what files drive A has on it that drive B doesn't.
    Is there an app that will scan both drives and tell me what files drive B is missing?
    Thank you!

    This is a nice use for command-line utilities. There are actually many variations on how you want the answer of what question. Disks are treated as folders in Unix, and presumably MacOSX. You can find them in /dev. The disk0 is the boot disk. Output of 'diff' is ready for use in scripts with 'ed' or 'sed'.
    Darwin commands & scripts
    You can experiment with 'apropos diff', 'whatis diff', 'whereis diff', and 'man diff | cat', where diff can be replaced with any command. Some useful commands might be 'diff', 'uniq', and 'crc' or 'md5'.
    Aqua applications
    If you're not interested in learning a Unix script language, you can find several suitable Aqua front-ends for them at Sorceforge, MacUpdate, or VersionFinder.
    http://www.macupdate.com/info.php/id/25426/diffmerge
    Bruce

  • Comparing contents of two text files

    I know that I can copy all contents of the two files into two strings, and then do str1.equals(str2). Any better way to do it?

    What kind of comparison do you want to do?
    - Exact - the files must have the same size, and have the same bytes, like "fc /b" in Windows
    The exact comparison is very easy to do: open the files as FileInputStreams and read both using byte buffers. Compare the byte buffers.
    If you can't open both files at the same time (for instance, one of the files is in a diskette and the other file is in another diskette, and you have only one diskette drive) you could try checking the digest of the files (java.security.MessageDigest). If the digest values match, probably the files are equal. If the digest values don't match, certainly the files are different.
    - Textual - you want to find differences between the files, and pinpoint them, like the "diff" command in Unix, or the "fc" command in Windows.
    Textual comparison is not easy to do (you'll need to keep lists of matching lines, and figure out if some sequence of lines was moved, changed etc.); but you can find the source code for it in several places.

  • How to compare content of two text file using StreamTokenizer

    hi....
    i have two text files...containg field like(name,number,scheme) and(number,date,value)... i want to create a third file containg field like (name,number,date,scheme,value) by using these two table. how to create

    I think this code can solve your problem.
    private static final String DELIM = ",";
    * Compile two files.
    * @param file1 String the input file 1
    * @param file2 String the input file 2
    * @param file3 String the output file
    * @throws IOException error in reading/writing
    public void compileFiles(String file1, String file2, String file3) throws
            IOException {
            BufferedReader reader1 = new BufferedReader(new InputStreamReader(
                new FileInputStream(file1)));
            BufferedReader reader2 = new BufferedReader(new InputStreamReader(
                new FileInputStream(file2)));
            BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
                new FileOutputStream(file3)));
            String line1 = reader1.readLine();
            String line2 = reader2.readLine();
            while (line1 != null && line2 != null) {
                writer.write(compileLines(line1, line2));
                writer.newLine();
                line1 = reader1.readLine();
                line2 = reader2.readLine();
            reader1.close();
            reader2.close();
            writer.close();
        private String compileLines(String line1, String line2) {
            StringTokenizer tok1 = new StringTokenizer(line1, DELIM);
            StringTokenizer tok2 = new StringTokenizer(line2, DELIM);
            String name = tok1.nextToken();
            String number = tok1.nextToken();
            String scheme = tok1.nextToken();
            // ignore number
            tok2.nextToken();
            String date = tok2.nextToken();
            String value = tok2.nextToken();
            StringBuffer buffer = new StringBuffer();
            buffer.append(name);
            buffer.append(DELIM);
            buffer.append(number);
            buffer.append(DELIM);
            buffer.append(date);
            buffer.append(DELIM);
            buffer.append(scheme);
            buffer.append(DELIM);
            buffer.append(value);
            return buffer.toString();
        }

  • How to merge the contents of two Photo Booths?

    Hello.  We have two Macbooks (Old + Existing).  Both are/were updated to Maverick.  However, I have restored the Old Macbook back to original (Snow Leopard) in order to sell.  I manually took off files as well as doing a Time Machine backup. 
    I would like to add all the photos and videos from Photo Booth on the Old Macbook into my Existing Macbook.
    Is this possible either a. through a specific file in Time Machine (I do NOT wish to replace the Existing with the Old.  This is a merger.) or b. with the Photo Booth library I copied onto an external harddrive?  However, this is one 1.75gb file with the Photo Booth icon (a film strip) rather than separate photo files.  I am unsure how to access individual photographs or videos.  I was hesitant to open it up in case it negatively affected the Existing Photo Booth.
    Thanks for any assistance.

    Great, I just lost 10 GB of data thanks to OSX folder merge... because appaerantly I should have known better not to keep a subfolder inside my folder I was trying to merge
    I can not beleive more people don't have a problem with this. Merge contents in Lion does NOT merge contents if 1 or more of those supposed "contents" is a subfolder
    Merge contents of two folders only works for files, it does NOT work for subfolders!!!!
    Can we please get this acknowledged as a bug that needs fixing?
    EXAMPLE:
    Drive1 / Folder1
                   - text1.txt
                   - text2.txt
                   - / subfolder / text3.text
    MERGE TO
    Drive2 / Folder1
                   - text1.txt  (this gets updated / merged)
                   - text2.txt  (this gets updated / merged)
                   - / subfolder /
                             - text.txt
                             - text2.txt     (this should get text3.txt merged into it, from Drive1, but instead this subfolder is REPLACED, and NOT MERGED!!)
    Why would i want to replace a folder if I'm trying to merge it!?
    Almost 2013 and OSX still cant merge a folder? unbelievable

  • Merge two folders (Finder crash during Move)

    i just had Finder quit again on a large move and rather than go through this set of folders and subfolders and subsubfolders to pick out what has transferred and what has not transferred i would like to MERGE this data and go into disk mode or move it in smaller chunks.
    i am actually moving from a mac pro on lion to a mbp on mountain lion.
    can anyone help me with this?
    TIA

    hotwheels 22 wrote:
    we are doing a totally fresh install and we were moving data manually in root user mode.
    You shouldn't be doing anything in the root user. You shouldn't even be booted into it. I don't understand not using Migration Assistant as you can pick and choose what to move Applications, data, settings... So, you could choose not to move Settings and start with a fresh set of prefs, if you were worried about "contaminating" your new Mac.
    I've never tried to move a 55GB folder, so I don't know how reliable Finder is. AFA 'merge"
    You should be able to merge the contents of two folders as long as you choose to copy those files instead of moving them. An option-drag should bring up the merge dialog?

  • Can we compare file contents of two files in the Application server?

    Hi,
    A file is generated daily to the application server. and i need to compare the generated file to the file generated on the previous day and prepare a report.
    Can we compare file contents of two generated files present in the Application server?
    If there is any alternative, please suggest.
    regards
    cs

    yes we can compare if the app server is Unix.
    cmp compare two binary files and report if different
    cmp is silent if the files are the
         same;
    if they differ, the byte and line number at which the first
    difference occurred is reported.
    REPORT ZUNIX line-size 400
                    no standard page heading.
    data: unixcom like   rlgrap-filename.  
    unixcom = 'cmp file1 file2'.
    data: begin of tabl occurs 500,
            line(400),
          end of tabl.
    data: lines type i.
    start-of-selection.
      refresh tabl.
      call 'SYSTEM' id 'COMMAND' field unixcom
                    id 'TAB'     field tabl[].
    "if the files are different then you will some content in tabl
    Regards
    Viajy  Babu Dudla

  • How to compare the contents of two XML documents

    Hi all,
    I was trying to compare the contents of two xml documents, they are both validate for the same XML Schema. i was using the xmlunit to do this. but some how it doesn't work like what i have expected. for example:
    1.xml : <test><item>2</item><item>1</item></test>
    2.xml: <test><item>3</item><item>2</item><item>1</item></test>
    the result from XMLUnit is this two xmls are different, but it compares <item>2</item> with <item>3</item>, which i cannot find out where the real diiffs are.
    does anybody know how i can do this correct?
    best regards,
    tina

    I faced a similar problem in one of my projects and hence wrote my own comparator. Most comparators like ExamXML etc show XML as different if the nodes under a parent node occur in different seqeunce or a set of repeated nodes occur in different sequence. The comparator that I wrote gives you the flexibility to configure how to identify a node from a set of repeated nodes and is able to compare them successfully if they occur in any order. You can view the sample output at http://geocities.com/dheerendra_itbhu/TipsFromDheeru.html
    and contact me in case you need the source code.

  • Hi, I have small problem, for some time in music area I had two folders to use 1. Apple loops for soundtrack pro 2. Final Cut pro sound effects now both are gray and with out content may I know what happend

    Hi, I have small problem, for some time in music area I had two folders to use 1. Apple loops for soundtrack pro 2. Final Cut pro sound effects now both are gray and with out content may I know what happend

    I just went through this and it appears that my Focusrite Saffire was the culprit. I connected all the outputs on the focusrite according to the way the jacsk on the back were labeled and then set up the multichannel speaker setup to match. Then I went into STP, created a pink noise clip and panned it around, the LFE, center and rears were not in the right place.
    I reconnected the hardware to match the 5.1 pan pot in STP then changed the multichannel speaker setup to match. Everything appears to be correct now but I would have loved to have been able to just assigned the output busses to correct outputs in the saffire.
    Next step is to pan that pink noise around with my SPL meter to calibrate the room.

  • How to compare the contents of two different tables

    hello. can somebody give me an idean on how to compare the contents of two different tables in mysql?
    example, i have a table named Main List and a table named New List.
    The contents of the New List should be compared to the contents of the
    Main List, to check if they are equal. I don't have any idea how to manipulate
    this data. Hoping for your help. Thanks.

    it is better to comapre it using java.. try get the resultset first and store that in collections then comapre the two collections

Maybe you are looking for

  • Not downloading.help!

    im trying to update songs on my ipod, but a little pop up pops and says that it "cannot be updated because all of the playlists selected for updating no longer exist." somebody help!

  • Trouble connecting ipod to computer

    When I plug my ipod nano into the computer the computer recognizes it as my ipod but a message keeps coming up on itunes saying an ipod has been detected but it cannot be identified properly and to disconnect and try again. I have done this repeatedl

  • How do I generate a sinusoidal waveform for frequency 0,05Hz?

    Hi everyone, I  generate a sinusoidal waveform for different amplitude and frequencies. However, I can not obtain a waveform for frequency<0,05 Hz. For the frequency values under freq=0,05 Hz, the vi gives an error as can be seen from the attachment

  • IPhoto '11 (9.2.1) Crashes when selecting File Preferences

    Hey guys, iPhoto 9.2.1 in Lion crashes every time I try and go to File>Preferences. Everything seems to be working properly except it crashes when I open "preferences".  Here's the error: Anbybody know what to do?  THanks Process:         iPhoto [219

  • Plug-in for chrome

    I want to use Adobe Reader for pdf docs in my Chrome browser but I don't have Adobe Reader plug-in at chrome://plugins/ My OS Win 7 Professional Adobe Reader XI