[opensuse] Directory merge utility
Hi, I have two similar directories that were both recovered from a bad Harddisk but with different methods. The directories have file differences, some files exist in one directory only and other files have different file sizes. I would like to merge the two directory structures, where the merged tree would have one copy of each file that exists in the two source directories but keep the file that is larger if it exists in both original directories. Is there a utility that can do this? Thank you, -- Bruce Samhaber Senior Hardware Design Consultant Tel: 613-724-5987 112 Kenora St. Fax: 613-724-5987 Ottawa, Ontario Cell: 613-297-6961 K1Y 3L1 mailto: bsamhaber@sympatico.ca http://www3.sympatico.ca/marypat/index.html -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 03/23/2010 08:30 PM, Bruce Samhaber wrote:
Hi,
I have two similar directories that were both recovered from a bad Harddisk but with different methods. The directories have file differences, some files exist in one directory only and other files have different file sizes. I would like to merge the two directory structures, where the merged tree would have one copy of each file that exists in the two source directories but keep the file that is larger if it exists in both original directories. Is there a utility that can do this?
Thank you,
Bruce, First thoughts - look at 'kdiff3' (part of kde3 included in kde4) that allows for directory comparison and then allows you to take action based on the file differences. If you need to automate the process, then: I have run into similar situations (not hard disk problems, but multiple dirs containing different copies of the same files) and the easiest solution I have found is to simply use a bash script to read each of the directories into arrays and then step through one array comparing the needed file attribute against the file from the second directory array and then either copying or moving based on the result of the test. I don't know what your bash skills are like, but an example of this 2 array comparison is in the 'fduprpm' script contained in my local repo set of scripts that you can grab here: http://www.3111skyline.com/download/openSUSE/pkgmanage/pkgmanage.tar.bz2 -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 03/23/2010 08:30 PM, Bruce Samhaber wrote:
Hi,
I have two similar directories that were both recovered from a bad Harddisk but with different methods. The directories have file differences, some files exist in one directory only and other files have different file sizes. I would like to merge the two directory structures, where the merged tree would have one copy of each file that exists in the two source directories but keep the file that is larger if it exists in both original directories. Is there a utility that can do this?
I have a Tcl script 'dirdiff' that does just this. I'm very happy with it. Its a script so no compilation needed. http://www.freshports.org/sysutils/dirdiff/ "Dirdiff now also has a file mode, which can be used for viewing the differences between files and for merging changes from one file into another. This mode is invoked if regular files are specified on the command line (or in the new directory/file chooser, see below) rather than directories. (Dirdiff will exit with an error message if some files and some directories are specified.)" "The diff display window can now display 3-way, 4-way and 5-way diffs as well as the normal 2-way diffs. When a line is identified as coming from multiple files, most of it will be colored for the newest of those files, and extra colored bars at the left of the line will identify which other files it is in." There's also a VIM plugin, but I haven't used that. -- A habit of basing convictions upon evidence, and of giving to them only that degree or certainty which the evidence warrants, would, if it became general, cure most of the ills from which the world suffers. -- Bertrand Russell -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
Anton Aylward
-
Bruce Samhaber
-
David C. Rankin