Steven Riley writes ..

>I'm new to the list and usually like to lurk for a while before asking
>questions but I've been faced with a problem which I'm struggling to
>find an answer.
>
>Can someone supply help or a URL to help me connecting to an NT server?
>Basically I want to connect to several servers over the internal
>LAN and find a file... if the file exists then I want to delete it.
>Not sure about the best way to do this... any help would be greatly
>appreciated.

Perl understands UNC paths and will invisibly open directories on remote
machines if you use the path .. so to find a file I'd recommend using the
File::Find module in conjunction with the an array of UNC paths that you
want searched .. eg.

  #!perl -w
  use strict;

  use File::Find;

  find( \&wanted, $_) for ( '\\\server1\share1', '\\\server2\share2');

  sub wanted {

      lc $_ eq 'some_file_name'         # case insensitive for Windoze
      && print("Deleting: $File::Find::name\n")
      && unlink $File::Find::name;
  }

  __END__

references:

  perldoc File::Find
  perldoc -f unlink

-- 
  jason king

  In Spearfish, South Dakota, if three or more Indians are walking down
  the street together, they can be considered a war party and fired
  upon. - http://dumblaws.com/

Reply via email to