-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot delete directory #317
Comments
S3 doesn't actually have directories, only files |
You're right, I basically meant a path ending with |
Agree, stripping of trailing "/" should only happen at list time, not for rm/open. Uncertain about info. |
Will port fsspec/gcsfs#273 to fix this |
In the current
even though s3resource = boto3.resource('s3', ...)
s3resource.Object('bucket', 'folder/').delete() ReproCreate the offending dir (yeah I know there are really no such things as folders in S3, only keys with a trailing BUCKET = 'bucket'
s3client = boto3.client('s3', ...)
s3client.put_object(Bucket=BUCKET, Key=('folder/')) s3fs can see it but can't delete it print(fs.exists(os.path.join(BUCKET, 'folder/'))) # True
fs.rm('bucket/folder/') # FileNotFoundError
fs.rm('bucket/folder/', recursive=True) # FileNotFoundError The workaround s3resource.Object(BUCKET, 'folder/').delete() |
Does the placeholder key show up with |
I'm hitting a similar issue when trying to use fs.rm(folder, recursive=True) : it works (everything is deleted) but fails with FileNotFoundError for the folder |
Thanks for the ping, I'll look into it. |
I get this error for either s3://bucket/path/ and /bucket/path, or bucket/path:
|
@leeprevost , please state exactly what you did, and the versions you are using. Your case seems to be very different from the rest of this issue. |
I'm running this in an ETL pyspark script and testing on an AWS glue container.
|
This is pretty old; I expect that maybe you have a version of fsspec which doesn't match. The best solution would be to update both to a consistent version (they are released together). |
I'm unable to delete an S3 directory, i.e. a path ending with
/
usingrm
norbulk_delete
. There is no error raised but the actual directory does not get deleted.Code to reproduce:
I guess this is the result of calling the
S3FileSystem.split_path(path)
which calls theAbstractFileSystem._strip_protocol(path)
which also strips the trailing slash.The text was updated successfully, but these errors were encountered: