I have azure file storage with other folders inside it. I want to check or track when that folder is last updated ?
I have done a simple console application to get all files from that location -
// Get list of all files/directories on the file share
CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["storageConnectionString"]);
CloudFileClient fileClient = cloudStorageAccount.CreateCloudFileClient();
CloudFileShare fileShare = fileClient.GetShareReference(ConfigurationManager.AppSettings["shareName"]);
var sourceName = fileShare.GetRootDirectoryReference().GetDirectoryReference((ConfigurationManager.AppSettings["sourceName"]));
IEnumerable<IListFileItem> fileList = sourceName.ListFilesAndDirectories();
CloudFileDirectory destinationDir = fileShare.GetRootDirectoryReference().GetDirectoryReference((ConfigurationManager.AppSettings["destinationName"]));
foreach (IListFileItem listItem in fileList)
{
// gives me all file records
}
I tried to get it like this but it is null
.
var test = sourceName.Properties.LastModified;
because of null i can not able to use this query :(
var latest= fileShare.GetRootDirectoryReference().ListFilesAndDirectories()
.OfType<CloudFileShare>()
.OrderByDescending(m => m.Properties.LastModified)
.ToList()
.First();
i just noticed that , i have uploaded one new file just now into that folder but still LastModified is old date , it means LastModified is separate for that folder and file :O what to do now ?
I want to check whether any new file is updated into any sub-fodler of main folder or not within 24hr.
I wonder how to I check the last updated file datetime from that source folder ?
why LastModified is null ?