Skip to content

Incorrectly deleting files based on wildcard #16

@joelu22

Description

@joelu22

Hello,

When I try to delete a file in the Jupyter UI it accidentally deletes similarly named files. For example, when I delete file, it also deletes file1 and file2.

To recreate:
1.) Update bucketname in the below code
2.) Run code
3.) In the Jupyter UI, try to delete 'file' that was just created
Result: 'file', 'file1', and 'file2' are removed
Expected Result: just 'file' should be removed


import numpy
from tensorflow.python.lib.io import file_io
from datetime import datetime

bucketname = 'myBucket'

print(datetime.now())
f = file_io.FileIO('gs://' + bucketname + '/file', "w")
numpy.savetxt(f, numpy.array(['1','2','3']), delimiter=',', fmt='%s')
f.flush()
f.close()

print(datetime.now())
f = file_io.FileIO('gs://' + bucketname + '/file1', "w")
numpy.savetxt(f, numpy.array(['1','2','3']), delimiter=',', fmt='%s')
f.flush()
f.close()

print(datetime.now())
f = file_io.FileIO('gs://' + bucketname + '/file2', "w")
numpy.savetxt(f, numpy.array(['1','2','3']), delimiter=',', fmt='%s')
f.flush()
f.close()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions