home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / FAQ / cgi-bin / discus4_00 / clean.pl < prev    next >
Perl Script  |  2009-11-06  |  1KB  |  36 lines

  1. #!/usr/bin/perl
  2.  
  3. # CLEANUP SCRIPT
  4. # Copyright (c) 1998-2002, DiscusWare, LLC, all rights reserved.
  5. # This script may not be redistributed or used except as provided
  6. # in the Discus license agreement.
  7.  
  8. opendir(DIR, ".");
  9. my @dir = grep { /^ftpdiag\./ } readdir(DIR);
  10. closedir(DIR);
  11.  
  12. if (scalar @dir == 0 && ! -e "./discus.conf" && ! -e "./install.txt") {
  13.     print "Nothing to clean\n";
  14. } else {
  15.     print "Do you want to clean this distribution by removing the following files?\n";
  16.     print "  - $dir[0]\n" if scalar @dir;
  17.     print "  - discus.conf\n" if -e "./discus.conf";
  18.     print "  - install.txt\n" if -e "./install.txt";
  19.     print "\n";
  20.     print "Your answer (y/n): ";
  21.     my $yn = <STDIN>;
  22.     if ($yn =~ /^y/i) {
  23.         unlink $dir[0];
  24.         unlink "./discus.conf";
  25.         unlink "./install.txt";
  26.         print "\n";
  27.         print "Distribution was cleaned\n\n";
  28.     } else {
  29.         print "\n";
  30.         print "Cleanup canceled by user\n\n";
  31.     }
  32.     print "Type 'perl upgrade.pl' to upgrade an existing board\n";
  33.     print "Type 'perl 1st_install.pl' to install a new board\n";
  34. }
  35.  
  36.