Thanks! That helped,
This is what my script looks like now:
#!/usr/local/bin/perl -w
use strict;
use File::Path;
use File::Copy;
my $file;
my $type;
my $currentLocation;
my $newLocation;
my $owner;
my $permissions;
open (MDATA, "meta-data") or die "Cannot open $!\n";
while (<MDATA>) {
chomp;
($file, $type, $currentLocation, $newLocation, $owner, $permissions)
= split /\t/;
forech $newLocation
if ( not -d $newLocation );
mkpath($newLocation, $owner, $permissions) or die "Couldn't
make the target directory: $!\n";
}
close MDATA
And this is the error I get:
Can't locate object method "forech" via package "www" (perhaps you forgot to
load "www"?) at ./creat
ion.pl line 17, <MDATA> line 1.
This is the line creation.pl is reading from the meta-data file:
index.html html /one/two/three/ www me 0755
What am I doing wrong?
-garrett
>From: Steve Mayer <[EMAIL PROTECTED]>
>To: garrett esperum <[EMAIL PROTECTED]>
>CC: [EMAIL PROTECTED]
>Subject: Re: V2 Sandbox Creation Script
>Date: Thu, 10 Jan 2002 14:49:57 -0800
>
>Garrett,
>
> Try changing the following line:
>
> system mkdir $location or die "Couldn't make the target directory:
>$!\n";
>
> to:
>
> mkpath($location,1,0777) or
> die "Couldn't make the target directory: $!\n";
>
> Good luck,
>
>Steve
>
>On Thu, Jan 10, 2002 at 02:38:50PM -0800, garrett esperum wrote:
> > Hello all,
> >
> > Below is what I have so far for my script, I can get every piece to work
> > correctly on it's own, nut I cannot get these two pieces to work
>together.
> > I think I am messing up the syntax of this script. What Am I doing
>wrong??
> > How do I loop in the Directory creation, and file copy procedures??
> >
> >
> > #!/usr/local/bin/perl -w
> >
> > use strict;
> > use File::Path;
> > use File::Copy;
> >
> > my $file;
> > my $type;
> > my $location;
> > my $owner;
> > my $permissions;
> > open (MDATA, "meta-data") or die "Cannot open $!\n";
> > while (<MDATA>) {
> > chomp;
> > ($file, $type, $location, $owner, $permissions) = split /\t/;
> > forech $location
> > {
> > unless( -d $location )
> > {
> > system mkdir $location or die "Couldn't make the target
> > directory: $!\n";
> > }
> > }
> > }
> > close MDATA
> >
> > Error:
> > --------------------------------------------------------
> > Global symbol "%location" requires explicit package name at
>./creation.pl
> > line 17.
> > syntax error at ./creation.pl line 17, near "$location
> > {"
> > syntax error at ./creation.pl line 22, near "}"
> > Execution of ./creation.pl aborted due to compilation errors.
> > ---------------------------------------------------------
> >
> > Thank You!
> >
> > -garrett
> >
> > _________________________________________________________________
> > MSN Photos is the easiest way to share and print your photos:
> > http://photos.msn.com/support/worldwide.aspx
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>=============================================================
>Steve Mayer Oracle Corporation
>Senior Member of Technical Staff 1211 SW 5th Ave.
>Portland Development Center Suite 900
>[EMAIL PROTECTED] Portland, OR 97204
>Phone: 503-525-3127
>=============================================================
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]