🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: ch.comp.os.linux
Article #14908

Re: Q: verify copy of directory tree?

#14908
From: Happl Oberlin
Date: Sat, 13 Jan 2001 16:14
31 lines
1939 bytes
In article <hi6p39.eo3.ln@celeron.localnet>, Joerg Hau 
<joerg.hau@swissonline.ch> wrote:

>I'm looking for a simple way to compare two complete diretory trees on
>a file-by-file basis. I thought of using 'find' together with 'cmp',
>something like
>  cd dir1; find . -type f -exec cmp {} ../dir2/{} \; 
>
>... the problem is that the file names used in {} contain at least
>some residues of the paths (demo: 'find . -type f -exec echo {} \;' ),
>so this does not work so easily ... did anybody work this out as an
>(almost) one-line procedure??

Not one line but short:

cd dir1
for FILE in `find . -type f -print | sort | cut -c3-`
do
 cmp $FILE ../dir2/$FILE
 if test $? -ne 0
 then
   echo "$dir1/$FILE und $dir2/$FILE sind verschieden!"
 fi
done

The output of find is not sorted alpahbetical, that's why
I'm sorting it. Further is the output preceeded by "./"
which I'm cutting of (cut -c3-).

Tschu-huuus!
Happl
Technical Details
Message-ID: <happl-597C47.17141213012001@news.bluewin.ch>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.cs.utwente.nl!newshunter!cosy.sbg.ac.at!ictas.tu-graz.ac.at!newsfeed.Austria.EU.net!newsfeed.kpnqwest.at!newsrouter.chello.at!newsmaster-01.atnet.at!atnet.at!newsfeed-zh.ip-plus.net!news.ip-plus.net!news.bluewin.ch!happl
References: <hi6p39.eo3.ln@celeron.localnet>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f4b73,888602c4238fd7ad
X-Google-Attributes: gidf4b73,public
X-Google-ArrivalTime: 2001-01-13 08:22:51 PST
From: Happl Oberlin <happl@mail.com>
Newsgroups: ch.comp.os.linux
Subject: Re: Q: verify copy of directory tree?
Date: Sat, 13 Jan 2001 17:14:12 +0100
Organization: ---
Lines: 31
Message-ID: <happl-597C47.17141213012001@news.bluewin.ch>
References: <hi6p39.eo3.ln@celeron.localnet>
NNTP-Posting-Host: bw1-61pub90.bluewin.ch
X-Trace: bw107zhb.bluewin.ch 979402451 24798 195.186.61.90 (13 Jan 2001 16:14:11 GMT)
X-Complaints-To: newsmaster@bluewin.ch
NNTP-Posting-Date: 13 Jan 2001 16:14:11 GMT
User-Agent: MT-NewsWatcher/3.0 (PPC)
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.cs.utwente.nl!newshunter!cosy.sbg.ac.at!ictas.tu-graz.ac.at!newsfeed.Austria.EU.net!newsfeed.kpnqwest.at!newsrouter.chello.at!newsmaster-01.atnet.at!atnet.at!newsfeed-zh.ip-plus.net!news.ip-plus.net!news.bluewin.ch!happl