This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Wed, 18 Feb 2004, Andreas Seidl wrote:Hmm, wouldn't the generic build script be the place to add functionality to remove empty directories? Doing it by hand adds work, and even worse, is a possible source for bugs, as a newer release might have actually files in directories which were empty before, and if overlooked, they could get removed.
Andreas,
Feel free to send a patch for this. ;-) Igor
----- begin -----
#!/usr/bin/bash
# rmed -- remove empty directories recursively
# usage: rmed [DIR] where DIR is an optional argument, the directory
# where to start examining.
# limitations:
# - spaces in file or direcory names
# - currently still prints instead of removing (remove # in line 19)
if [ -z "$1" ] ; then
basedir="."
else
basedir=$1
fi
cd $basedir
dirs=`\ls -F | grep '/' | sed sx/xx`
for dir in $dirs ; do
#echo " examining $dir"
if [ -z "`\ls $dir`" ] ; then
echo "empty: `pwd`/$dir"
#rmdir $dir
else
rmed $dir
fi
done
cd -
----- end -----| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |