Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have stumbled into a dumb usage case. I want to merge two folders in a particular way (I guess these are called folders now, I still think of them as directories, but whatever). The folders have the following characteristics:

  • Largely identical content (but some unique content in each)
  • Largely identical folder structure
  • Folder A has older file modified dates on some identical content
  • Folder B has newer file modified dates on some non-identical content

What I want to do is merge Folder A and Folder B such that at least one of them fulfills the following criteria:

  • Has all files that were previously in A and B
  • Has the all of the folder structure that was in A or B
  • For identical files has the version of the file with the older modified date
  • For non-identical files has the version of the file with the newer modified date

These are huge folders. I have spent the past 24 hours trying to hack together a script (in R, because when all you have is a hammer everything looks like a nail) that would do this using text output from CloneSpy and getting file modified dates from R's file querying functions... but that solution is /slow/ and I haven't been able to piece anything together. I admit my usage case is weird, but it doesn't seem like it would be entirely unique. Any idea how I can do this more simply?

share|improve this question
    
For "identical files," do you mean their actual contents or just going by file system data such as name? –  Patrick S. Mar 23 '13 at 15:45
    
I mean actual contents. I am willing to accept some small possibility of failure by comparing hashes rather than files directly. –  Russell S. Pierce Mar 23 '13 at 15:52
    
I think that your request can only be fulfilled by an had hoc script. You might need a command line tool for generating file checksum, such as CRC or MD5 or SHA-1 (CRC is the fastest, so it should be most suitable for your request) and then a script that compares the checksum string and the file date. I can't think of a faster way to do so. If you need help with the script code, please ask. If you have Vista or newer, you might consider using MS Powershell as a scripting tool. –  Pincopallino Mar 23 '13 at 17:02
    
@Pincopallino: I'm thinking you are right. Should I delete the question or wait for someone to nominate it to be closed as too localized? –  Russell S. Pierce Mar 23 '13 at 19:13
    
I think that you should write an answer in which you explain how you solved your problem and perhaps paste the code of your script. It might still be useful to someone else in the future. –  Pincopallino Mar 24 '13 at 9:48

1 Answer 1

If it is text based files and you are looking not only for duplicates, but also for removal of near duplicates, you can try http://www.softcorporation.com/products/neardup/ It is Java based, so it should work under Windows. I guess it can create a report of which files are duplicates and then you can process the report and delete older files.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.