awslabs/mountpoint-s3

Keep local view of a directory after all files in the directory have been deleted

Opened this issue · 0 comments

Tell us more about this new feature.

Today if you delete all files in an implicit directory (directory that is not mapped directly to an object), the directory will disappear after the last file in that directory has been deleted. For example, consider your bucket has the following keys:

colors/blue/image1.jpg
colors/blue/image2.jpg
colors/red/image.jpg
colors/list.txt

The blue directory is an implicit directly as it relies on colors/blue/image1.jpg and colors/blue/image2.jpg to exist. When a user deletes image1.jpg and image2.jpg from Mountpoint the bucket will be left with the following keys:

colors/red/image.jpg
colors/list.txt

This means the next lookup on blue directory will fail with ENOENT.

This behavior does not align with other file systems and could be unexpected for some applications. Mountpoint should keep the local view of the implicit directory unless there is an rmdir call to remove the empty directory.