s3fs icon indicating copy to clipboard operation
s3fs copied to clipboard

rm does not delete the directory if its input is a directory with recursive True

Open LuchiLucs opened this issue 3 months ago • 5 comments

As stated in the title, it seems to me, that the API rm does not remove the directory itself if the input path its a directory and the recursive flag is set to True:

  await self.fs._rm(
      path=f"{self.bucket_name}/{remote_path}",
      recursive=True,
      **kwargs,
  )

I checked by s3 bucket from the dashboard and the directory does still exists, while its content does not. The documentation says that:

recursive (bool) – If file(s) are directories, recursively delete contents and then also remove the directory

I guess the implementation does not follow the documentation and a direct rmdir API call is needed in order to delete also the directory.

LuchiLucs avatar Dec 02 '24 17:12 LuchiLucs