Re: merging directories
From: Stephen Baynes. (stephen.baynes_at_soton.sc.philips.REMOVETHIS.com)
Date: 01/16/04
- Next message: udayan: "automatic login by telnet session"
- Previous message: Eric Moors: "Re: zsh bug?"
- In reply to:(deleted message) Martin Trautmann: "merging directories"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 16 Jan 2004 12:57:26 -0000
"Martin Trautmann" <t-use@gmx.net> wrote in message news:slrnc0d36e.5sk.t-use@ID-685.user.dfncis.de...
>
> Hi all,
>
> do you know any scripts around in order to merge two directories? It
> should be significantly better than a 'mv' or 'gtar -d' or basic rsync:
>
> Two directories may contain differently named, binary identical files
> (if anyone is interested: e.g. a spidered website for two different
> years and a reorganisation in between)
>
> Thus a first step would be to identify duplicates, e.g. by an ls -l,
> sorting by size, comparing the contents (e.g. by comparing an md5
> checksum, a binary diff, a 'cmp').
Here is a short script that finds duplicates in a directory tree by cksum.
#!/bin/sh
find "$@" -type f -exec cksum '{}' ';' | sort | awk '$1==lsum && hdone!=$1 { print $1; print " ",lfile ; hdone=$1 };$1==lsum {
print " ",$0 };{ lsum = $1; lfile = $0 }'
It might get you started.
- Next message: udayan: "automatic login by telnet session"
- Previous message: Eric Moors: "Re: zsh bug?"
- In reply to:(deleted message) Martin Trautmann: "merging directories"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|