Cannot delete blob with backslash in the filename

Shaun Bailey 86 Reputation points
2023-12-08T19:02:35.0233333+00:00

We have an Azure Data Lake V2 that we've given access to several of our partners via SFTP. Unfortunately, one of those partners uploaded a file with a backslash in the filename. While the UI won't allow me to mistakenly upload those files, there is no prevention on SFTP uploads. And when I try to delete the file through the SFTP or through the UI, it throws an error stating that it cannot find the file.

Help!

error

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,559 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 33,071 Reputation points Volunteer Moderator
    2023-12-09T16:19:52.3933333+00:00

    Dealing with a file with a backslash in its filename in Azure Data Lake is a nightmare sometimes because they are often interpreted as directory separators in file paths. Try using CLI and use the az storage blob delete command to delete the file. You might need to escape the backslash in the filename. For example, if your file is named file\name.txt, you would reference it as file\\name.txt.

    If the CLI method doesn't work, you could use the Azure Storage Blob REST API. In this case you'll need to generate a Shared Access Signature (SAS) token for authentication. Use a REST client or a tool like curl to send a DELETE request to the Blob service REST API, making sure to properly escape the backslash in the filename.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.