From owner-freebsd-questions Fri Oct 25 1:44:39 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1D28537B401 for ; Fri, 25 Oct 2002 01:44:37 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (ns0.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id EEFF343E6E for ; Fri, 25 Oct 2002 01:44:35 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) by smtp.infracaninophile.co.uk (8.12.6/8.12.6) with ESMTP id g9P8iUV8001050 for ; Fri, 25 Oct 2002 09:44:30 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost) by happy-idiot-talk.infracaninophile.co.uk (8.12.6/8.12.6/Submit) id g9P8iPeF001049 for freebsd-questions@FreeBSD.ORG; Fri, 25 Oct 2002 09:44:25 +0100 (BST) Date: Fri, 25 Oct 2002 09:44:25 +0100 From: Matthew Seaman To: freebsd-questions@FreeBSD.ORG Subject: Re: perl / ksh help Message-ID: <20021025084425.GB723@happy-idiot-talk.infracaninophi> Mail-Followup-To: Matthew Seaman , freebsd-questions@FreeBSD.ORG References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.1i X-Spam-Status: No, hits=-13.4 required=5.0 tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01, USER_AGENT,USER_AGENT_MUTT version=2.41 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Oct 25, 2002 at 04:43:15AM +0200, rootjrs wrote: > I know some one has already done this and I need a little help. I have > two identical directories on two seperate machines. The files were > moved over fromm machine a to machine b. Everything is working > properly on machine b but all of the permissions were lost. > > I've done the following: > > (machine a)# find ./ -ls -print > perm.list > > Gave me the file listing and permisions > > (machine a)# cat perm.list | awk '{print $4," ",$11}' > newperm.list > > This removed garbage like date owners etc that I didn't need. > > Now I'm stuck with a file that looks like this: > > -rw-r--r-- ./data/dir/data/getme.bin.old > -rw-rw-rw- ./data/dir/data/stp.501 > drwxrwxrwx ./data/dir/data/realgoodgold > -rwsr-xr-x ./data/dir/exe/help > > At this point I'm thinking great, now all I need is to create a perl or > shell script that converts the -rw-r--r--, etc into some sort of numerical value and then > do soemthing like this > > for > chmod $1 $2 > done > > .....using perl or ksh. However I can't figure out how to do the > conversion correctly. Please will one of you perl / ksh experts please > help me out. Instead of beating your brains out writing scripts to do this, simply install ports/net/rsync. Then synchronizing the file systems on the two boxes is simple. From the machine with the original copy of the data: rsync -avx --delete /path/to/data/dir/ other.machine.com:/path/to/data/dir/ This will copy the data from the original filesystem to the second one using the minimum amount of network traffic possible. Nb. the trailing slashes on those paths are important. Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message