> Calling perl gurus,
> Hello, help please!!! Looking to delete empty directories, I have a
script
> for that but if the directories have files in them, it dies. Either can
I
> add some type of script to delete them also or can I just avoid them all
> together and just delete the empty ones. Any help would be much
> appreciated. Thank you.
> P.S. All directories are capital letters, that's how I call them. All
> lowercase needs to stay in directory. Thanks again.
I am having some difficulty understanding your question.
If you just want to modify this script so that it does not die if the
directory contains files change the following:
[snip]
> if ((-d $Name) and ($Name =~ /^[A-Z]+$/)) {rmdir $Name or die $!};
[snip]
Change this line to:
if ((-d $Name) and ($Name =~ /^[A-Z]+$/)) {rmdir $Name};
Its not pretty or elegant but it solves your immediate problem.
A better solution may be to enter each directory within "." and if there
are more than two entries (. and ..)
then you cannot remove this directory.
-----------------------------------------
Craig Moynes
[EMAIL PROTECTED]