How to move files from a folder which are created with only todays date?


I have files in a folder and I want to move only specific file extension files ex: *.txt which are created with the current date.

I can move the files but I cant get to move only current date…

Can someone give me some thought process…


Use the GetLastWriteTime method to get the datetime when the file was created. This is an attribute of any File object you have read from a directory.

Hi @nanduedi,

Check this linq query to get files from the directory,

Directory.GetFiles("yourdirpath").[Select](Function(f) New FileInfo(f)).Where(Function(f) f.CreationTime = DateTime.Now AndAlso f.Extension.Equals(".txt") ).ToList()


I am getting below error…

I resolved by making small changes…

Directory.GetFiles(“C:\Downloads”,“*.txt”).Where(Function(f) New FileInfo(f).CreationTime.ToShortDateString=Vardate).ToArray

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.