File:  [Local Repository] / db / prgsrc / deletefiles.pl
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Fri Jul 27 23:54:07 2001 UTC (22 years, 9 months ago) by boris
Branches: MAIN
CVS tags: HEAD
Added new script

    1: #!/usr/local/bin/perl -w
    2: 
    3: =head1 NAME
    4: 
    5: deletefiles.pl - a script for deleting files form the database
    6: 
    7: =head1 SYNOPSIS
    8: 
    9: deletefiles.pl  [B<-y>|B<-n>] file file file...
   10: 
   11: 
   12: =head1 DESCRIPTION
   13: 
   14: The script will delete all questions with the given file name(s) from the
   15: database
   16: 
   17: =head1 OPTIONS
   18: 
   19: 
   20: =item B<-y>
   21: 
   22: Answer 'yes' to all questions
   23: 
   24: =item B<-n>
   25: 
   26: Answer 'no' to all questions
   27: 
   28: 
   29: =head1 BUGS
   30: 
   31: The database, user and password are hardcoded. 
   32: 
   33: =head1 SEE ALSO
   34: 
   35: createindex.pl(1)
   36: 
   37: =head1 AUTHOR
   38: 
   39: Boris Veytsman
   40: 
   41: =head1 $Id: deletefiles.pl,v 1.1 2001/07/27 23:54:07 boris Exp $
   42: 
   43: =cut
   44: 
   45:     use strict;
   46: use vars qw($opt_h $opt_y $opt_n);
   47: 
   48: use Getopt::Std;
   49: use DBI;
   50: 
   51: MAIN: 
   52: {
   53:     my $USAGE="Usage: deletefiles.pl [-y|-n][-r] file file file...\n";
   54:     getopts('ynh') or die $USAGE;
   55:     if ($opt_h) {
   56: 	print $USAGE;
   57: 	exit 0;
   58:     }
   59:     my $decision='askuser';
   60:     if ($opt_y) {
   61: 	$decision = 'yes';
   62:     } 
   63:     if ($opt_n ) {
   64: 	$decision = 'no';
   65:     }
   66:     my($dbh) = DBI->connect("DBI:mysql:chgk", "piataev", "") 
   67: 	or die "Can't connect to DB chgk\n";
   68: 
   69: }
   70: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>