Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <008c01c1eb88$b9c01f20$42a18c09@wdg.uk.ibm.com> From: "Max Bowsher" To: "Michael A Chase" , References: <00ec01c1eac6$597b94e0$42a18c09 AT wdg DOT uk DOT ibm DOT com> Subject: Re: clean_setup.pl proposed addition Date: Wed, 24 Apr 2002 13:08:20 +0100 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0089_01C1EB91.1B678940" X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-OriginalArrivalTime: 24 Apr 2002 12:08:20.0754 (UTC) FILETIME=[B9C01F20:01C1EB88] ------=_NextPart_000_0089_01C1EB91.1B678940 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit > No need for a patch. I've added options -install and -source to control > reporting of missing install or source tarballs. I also added '-H mask' > to let you skip packages that aren't of interest. Excellent! Thanks. Here is another suggestion, this time with patch: Split the delete files and delete empty directories actions invoked by the Arch option. The patch keeps Arch meaning to delete archives, and adds EDir for empty directories. Max. ------=_NextPart_000_0089_01C1EB91.1B678940 Content-Type: application/octet-stream; name="clean_setup_1.0302_edir.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="clean_setup_1.0302_edir.patch" --- clean_setup_1.0302orig.pl Tue Apr 23 11:40:48 2002=0A= +++ clean_setup_1.0302m.pl Wed Apr 24 13:04:04 2002=0A= @@ -50,6 +50,7 @@=0A= =20 # Initialize options my $bArch =3D 0; +my $bEDir =3D 1; my $bMove =3D 0; my $bSetup =3D 0; my $bCurr =3D 1; @@ -71,7 +72,8 @@=0A= syntax: $RealScript [opt] Opt: ($VERSION) -[no]Move =3D [Don't] Move archive files to base directory tree = ($bMove) - -[no]Arch =3D [Don't] Delete obsolete archives and directories = ($bArch) + -[no]Arch =3D [Don't] Delete obsolete archives ($bArch) + -[no]EDir =3D [Don't] Delete empty directories ($bEDir) -[no]Setup =3D [Don't] Delete obsolete setup.ini files ($bSetup), = forces -Move -[no]curr =3D [Don't] Report missing [curr] files ($bCurr) -[no]prev =3D [Don't] Report missing [prev] files ($bPrev) @@ -97,6 +99,7 @@=0A= Getopt::Long::config( qw( no_ignore_case no_auto_abbrev require_order ) = ); GetOptions( 'Arch!' =3D> \$bArch, + 'EDir!' =3D> \$bEDir, 'Move!' =3D> \$bMove, 'Setup!' =3D> \$bSetup, 'curr!' =3D> \$bCurr, @@ -119,7 +122,8 @@=0A= $sDir0 =3D~ s,\\,/,g; my $sOpt =3D ''; $sOpt .=3D "\nMoving archives to base directory tree" if $bMove; -$sOpt .=3D "\nDeleting unused files and empty directores" if $bArch; +$sOpt .=3D "\nDeleting unused files" if $bArch; +$sOpt .=3D "\nDeleting empty directores" if $bEDir; $sOpt .=3D "\nDeleting obsolete setup.ini files" if $bSetup; $sOpt .=3D "\nIgnoring files and directories: " . join ' ', map { = "'$_'" } @sIgnore if @sIgnore; @@ -345,10 +349,10 @@=0A= foreach $sRel ( sort { length $b <=3D> length $a || $a cmp $b } keys = %bDir ) { @g =3D glob( File::Spec -> catfile( $sRel, "*" ) ); if ( ! @g ) { - print $bArch ? "\n" : "\nNot ", "Removing Empty Directories\n" + print $bEDir ? "\n" : "\nNot ", "Removing Empty Directories\n" if ! $bFound++; print sUnPercent( " $sRel\n" ); - if ( $bArch ) { + if ( $bEDir ) { rmdir $sRel or print " *** Can't rmdir, $!\n"; } } ------=_NextPart_000_0089_01C1EB91.1B678940 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------=_NextPart_000_0089_01C1EB91.1B678940--