nice new tool to show version of feisty meow
[feisty_meow.git] / scripts / files / zapdirs.pl
1 #!/usr/bin/perl
2
3 ###############################################################################
4 #                                                                             #
5 #  Name   : zapdirs                                                           #
6 #  Author : Chris Koeritz                                                     #
7 #  Rights : Copyright (C) 1996-$now by Author                                 #
8 #                                                                             #
9 #  Purpose:                                                                   #
10 #                                                                             #
11 #    Removes a list of directories that are expected to be empty.  This       #
12 #  cleans out any filenames that are considered unimportant first.            #
13 #                                                                             #
14 ###############################################################################
15 #  This program is free software; you can redistribute it and/or modify it    #
16 #  under the terms of the GNU General Public License as published by the Free #
17 #  Software Foundation; either version 2 of the License or (at your option)   #
18 #  any later version.  See: "http://www.gruntose.com/Info/GNU/GPL.html" for a #
19 #  version of the License.  Please send any updates to "fred@gruntose.com".   #
20 ###############################################################################
21
22 require "zap_the_dir.pl";
23
24 $DEV_NULL = "> /dev/null 2> /dev/null";
25 #hmmm: move this to a useful location in a perl library.
26 if ($OS == "UNIX") {
27   $FIND_ENDING = "';'";
28 } elsif ( ($OS == "DOS") || ($OS == "Windows_95")
29     || ($OS == "Windows_98") || ($OS == "Windows_NT") ) {
30   $FIND_ENDING = "';'";
31 } else {
32   die "The Operating System variable (OS) is not set.\n";
33 }
34
35 local(@to_zap) = ();  # the array to zap out.
36
37 if ($#ARGV < 0) {
38   # no parms; give a default list.
39   @to_zap = (".");
40 } else {
41   @to_zap = &glob_list(@ARGV);
42   if ($#to_zap < 0) {
43     local($plural) = "";
44     if ($#ARGV > 0) { $plural = "s"; }
45     print "The directory name$plural \"@ARGV\" cannot be found.\n";
46     exit 0;
47   }
48 }
49
50 #print "zap list is:\n@to_zap\n";
51
52 &recursively_zap_dirs(@to_zap);
53
54 exit 0;
55