find generates spurious error message

Paul Almquist <[email protected]>
Newsgroups gmane.comp.gnu.fileutils.bugs
Message-ID <[email protected]>
Here is a script that says is all:
#-------------------------   cut here   -----------------------------------
#!/bin/bash
#   Complaint:  find generating spurious error message when removings
#               empty directory.
#
#               This problem is reproducible as illustrated below.
#
#               This error message misleads the user into thinking
#               that something did not work correctly so debugging
#               was done only to discover that the messages is false.
#               Now that I have resolved this issue I vaguely remember
#               going thru this some time ago.  No doubt others have
#		 as well.  Please fix so none else has to repeat this.
#
#  Using:
#       find  --version  reports:
#               GNU find version 4.1.7
#
#       rmdir --version  reports:
#               rmdir (fileutils) 4.1
#               Written by David MacKenzie.
#
#  Running on RedHat Linux 7.3
#       kernel:  2.4.18-3

clear
mkdir -p /tmp/dir/subdir1/subdir2

echo "Before - test case as reported by 'tree'"
tree /tmp/dir


echo "Note that  /tmp/dir/subdir1/subdir2  exists"
echo
echo "directories as find reports them"
find /tmp/dir  -type d


echo
echo "now removing empty directory"
find /tmp/dir  -type d  -exec rmdir --ignore-fail-on-non-empty {} \;


echo
echo "note above error message regarding 'subdir2' but the directory was found 
and removed"
echo

echo "After - test case as reported by 'tree'"
echo "Note that  /tmp/dir/subdir1/subdir2  no longer exists"
tree /tmp/dir
echo
echo "directories as find reports them"
find /tmp/dir  -type d


# -- cleanup

rmdir /tmp/dir/subdir1 /tmp/dir
echo


#-------------------------   cut here   -----------------------------------



paul
-- 
Paul F. Almquist
CIS/CNS Instructor
Unix/Linux specialist
Chippewa Valley Technical College
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.