home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5562 < prev    next >
Encoding:
Text File  |  1992-08-27  |  1.2 KB  |  43 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!fmrco!fmrco!asherman
  3. From: asherman@laser.fmrco.com (Aaron Sherman)
  4. Subject: Re: got a symlink checker/chaser for crontab?
  5. In-Reply-To: dansmith@Autodesk.COM's message of 27 Aug 92 00:43:12 GMT
  6. Message-ID: <ASHERMAN.92Aug27170323@laser.fmrco.com>
  7. Sender: news@fmrco.uucp
  8. Organization: I-Kinetics, 19 Bishop-Allen Dr., Cambridge, MA
  9. References: <17544@autodesk.COM>
  10. Date: Thu, 27 Aug 1992 22:03:23 GMT
  11. Lines: 30
  12.  
  13.  
  14. I just posted (mere days ago) an article titled:
  15.  
  16.     "Re: Filename expansion ("~user")"
  17.         (ID: <ASHERMAN.92Aug22193046@laser.fmrco.com>)
  18.  
  19. This contained a library routine for perl that did lots of file-name
  20. resolution like that.
  21.  
  22. But, for your purposes, this will work:
  23.  
  24.     #!/usr/local/bin/perl -- # Or wherever...
  25.     # WARNING: UNTESTED!!!
  26.  
  27.     open(P,'find / -type -l -print 2> /dev/null |') ||
  28.         die("Cannot fork: $!\n");
  29.  
  30.     while(<P>)
  31.     {
  32.         print "No such file: ", readlink($_), " pointed to by: ",
  33.             $_, "\n" if (! -e $_);
  34.     }
  35.     close(P); # Kill damuda
  36.  
  37.     exit(0);
  38. --
  39. --------
  40. Disclaimer: I am solely responsible for the content of this message.
  41. The views expressed here may not be the views of I-Kinetics, Fidelity,
  42. any of the Fidelity-owned corporations or my mother.
  43.