|
Posted by nolo contendere on February 27, 2008, 4:02 pm
Please log in for more thread options > > Can you post a workable piece of code, along with the actual message
> > returned by Perl, along with perhaps a copy/paste of you "ls'ing" to
> > one of those dirs successfully?
>
> Here you go:
>
> # read config file in
> # add inside test.conf directories such as /home/foo/logs or whatever.
> save the file.
> open($log_file_handler,"<", "test.conf") or die "Can't open config file
> \n";
>
> DISTRIBUTION_CENTER:
> while (<$log_file_handler>) {
> =A0 =A0 =A0 =A0 chomp;
> =A0 =A0 =A0 =A0 s/#.*//; # Remove comments
> =A0 =A0 =A0 =A0 s/^ *//; #Remove leading spaces
> =A0 =A0 =A0 =A0 s/ *$//; #Remove trailing spaces
> =A0 =A0 =A0 =A0 next DISTRIBUTION_CENTER if /^(\s)*$/; =A0# skip blank lin=
es
>
> =A0 =A0 =A0 =A0 push @directories_to_clean, $_; #add entries to an array
>
> }
>
> #it's supposed to go inside each directory
> foreach (@directories_to_clean){
> =A0 =A0 chomp;
> =A0 =A0 print "$_\n"; =A0 =A0#testing if I got the right directories and I=
do
> ex: /home/foo/logs
Here, try:
if ( -d $_ ) {
print "this is a directory\n";
else {
print ">>$_<< is not a directory.\n";
}
> =A0 =A0 opendir (ARCHIVE, $_) or die "what the?...$!";
> =A0 =A0 chdir $_; =A0#it doesn't get this far
>
> }
>
> ERROR: what the hell?...No such file or directory.
|