We have created two Gen 2 storage account. Creating an item in one data lake container creates a 0 KB file with the same name as that of the file or folder. Attached the screen shot of the container items with the additional file that is created and below is the code that creates the directory and items in it.
Note:- The same code in another storage account in the same subscription does not create this additional file.
public static async Task StoreTobigatewaygen2(string path, string filename, byte[] barray)
{
try
{
var fullpath = $"tagdata-full/";
string directoryname = $"{fullpath}{path}";
StorageSharedKeyCredential sharedKeyCredential = new StorageSharedKeyCredential(_accountName, _accountKey);
string dfsUri = "https://" + _accountName + ".blob.core.windows.net";
DataLakeServiceClient dataLakeServiceClient = new DataLakeServiceClient(new Uri(dfsUri), sharedKeyCredential);
DataLakeFileSystemClient fileSystemClient = dataLakeServiceClient.GetFileSystemClient(_fileSystemName);
DataLakeFileClient fileClient = fileSystemClient.GetFileClient(directoryname + @"/" + filename);
if (!fileClient.Exists(default) || fileClient.GetProperties().Value.CreatedOn < FirstRun.DT)
{
fileClient = await fileSystemClient.CreateFileAsync(directoryname + @"/"+ filename);
offset = 0;
}
else
{
offset = fileClient.GetProperties().Value.ContentLength;
}
using (MemoryStream memorystream = new MemoryStream(barray))
{
fileClient.Append(memorystream, offset: offset);
fileClient.Flush(position: offset + barray.Length);
}
return;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}