I didn't run this, but it looks like your chmod line should read
chmod $mode, $targfile;
instead (you where chmoding the backup). Anyway, I do believe this
addresses his problem.
charles
On Mon, 13 Dec 1999, a mole wrote:
> #!/usr/bin/perl
>
> use strict;
> use File::Basename;
> use IO::File;
> use vars qw / $backdir $backfile $targdir $targfile /;
> use vars qw / $mode $f /;
>
> $backdir = "/mnt/backups/etc";
> $targdir = "/etc";
>
> $f = new IO::File;
> open ($f, "find $targdir|") || die "Find failed: $targdir: $!\n";
>
> while (<$f>) {
> chomp($targfile = $_);
>
> $backfile = $targfile;
> $backfile =~ s/^$targdir//;
> $backfile = $backdir . "/" . $backfile;
>
> $mode = (stat($backfile))[2] ||\
> print STDERR "Stat failed: $backfile: $!\n";
> printf "$backfile: %04o\n", $mode & 07777;
> chmod $mode, $backfile;
> }
>
> exit(0);
> > I stupidly managed to change all the files in my /etc/ directory to
> > 755 permissions (directories too) and now things are complaining and
> > I also think that this is not a very secure way for my /etc/
> > directory to be...
> >
> > I have a backup of this directory with all the correct permissions
> > set on another drive - but the files are a bit out of date.
> >
> > what I was wondering is is someone able to help me string together a
> > command or script (shell is good - perl is more fun as I'm trying to
> > learn) that says this:
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.