[comp.unix.wizards] REQUEST HELP --- Merging Similar Directories.

milton@ektools.UUCP (Milton P. Bordenschnocker) (01/27/89)

    Situation:	I have two nearly identical directories.
		One is from a backup, and the other is real.
		Both contain files and sub-directories
		that the other does not have.

    Wish list:	I would like a way of merging the two directories,
		This needs to be done in such a way that in case of
		duplicate files the most recent file is the one used.

    Request:	Does anyone have a script or a utility for performing
		this task that I may have?

    Thanks in Advance.
    ...rochester!kodak!ektools!milton

les@chinet.chi.il.us (Leslie Mikesell) (01/28/89)

In article <1721@ektools.UUCP> milton@ektools.UUCP (Milton P. Bordenschnocker) writes:

>    Situation:	I have two nearly identical directories.
 >		One is from a backup, and the other is real.
 >		Both contain files and sub-directories
 >		that the other does not have.

>    Wish list:	I would like a way of merging the two directories,
 >		This needs to be done in such a way that in case of
 >		duplicate files the most recent file is the one used.

If the backup is via cpio you can just restore it into the the current
directory without the -u flag and end up with the newest copies of everything.
Otherwise you can make a cpio copy of your current directory:
  cd dir; find . -depth -print |cpio -ocv >file_or_tape
Then restore your backup copy and update with:
  cd dir; cpio -icvmd <file_or_tape 

Les Mikesell