Gallagher, Tim F (NE) am Dienstag, 12. September 2006 20:39:
> I need to move 3TB of data to a new SAN.  I have to make sure that I
> have the correct tights to move the data so I want to test my data
> before the move.  I want to walk the data and see if I have access to
> all the files.  I am not sure how to test the files to see if I have
> access or not.  I don't need to know what access I need to know if
> anyone took my group out.  I can still stat a file but how can I test
> for write access without writing to a file.  Here is what I have
>
> use File::DirWalk;
> my $dw = new File::DirWalk;
> $dw->onFile(sub {
>             my ($file) = @_;
>             if(length($file) < 1)

I don't work on windows anymore, but what about 

              if (-r $file) # is file readable?

See perldoc -f -X

(I don't quite understand why you should have to test for *write* access of 
files to copy ?!? If you have to: Try the -w test)

>
>             {
>                         print " #####!!!### ------> Paused File =
> $file\n";
>                         $pause = <STDIN>;
>             }
>             print $file . "\n";
>             return File::DirWalk::SUCCESS;
> });
>
> my($walkPath) = @ARGV;
> chomp($walkPath);
> $dw->walk($walkPath);
>
> I used a length comparison to see if files that I don't have access too
> returns a length.  Any Ideas?

Hope this helps

Dani

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to