1

I'm getting this kind of error when i'm deleting file on my AIX machine. Getting same error for rmdir.

pwd
/hm/dev/application/backup/ear

rm -rf resources
rm: Directory resources is not empty.

I tried to find out the hidden files using ls -lart under resources and ear directory. But there are no hidden files.

6
  • 1
    Does find show anything? Others report problems deleting NFS-mounted directories on AIX, or having to run fsck to deal with broken directory entries.
    – dhag
    Mar 17, 2015 at 11:28
  • any related error running errpt -a ?
    – Archemar
    Mar 17, 2015 at 11:35
  • Does resources have a filesystem mounted on it? Mar 18, 2015 at 0:09
  • @MarkPlotnick, /ear is mounted .. I successfully deleted all the sub dir and files under /ear directory except resources/.
    – Prime
    Mar 18, 2015 at 7:18
  • 1
    there may be a process holding a filehandle open under that directory; try fuser and/or lsof to investigate.
    – Jeff Schaller
    Jun 8, 2015 at 13:53

1 Answer 1

1

One of the cases this happens is that when there's an application keeps writing to the directory, so the command will remove the directory contents and tries to remove the directory itself but fails because new contents have been written.

When I experienced this, I searched for the application that keeps writing to it, stop writing new files and the directory remove got executed successfully. You can use

lsof | grep /my/directory/path

to find the application that does this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .