I am trying to copy files from one folder to another folder, i has to get only one month files for example the files should copy only from 27/8/2016 to till date if i run now, i coded for this but its not working its copying January files also can anyone suggest what need to change.
Public Sub FileCopy(src As String, dest As String)
Dim lastOneMonth As DateTime = DateTime.Now.AddMonths(-1)
Dim DateModified = File.GetCreationTime("D:\Working Files\Commercial Team\Retail\Billing\Invoices\2016")
If DateModified >= lastOneMonth Then
Dim totalFiles As Integer = 0
Dim filePath As String = Path.GetDirectoryName(file__1)Dim fileName As String = Path.GetFileNameWithoutExtension(file__1.ToString())If fileName.Contains("_I-") OrElse fileName.Contains("_IS") OrElse fileName.Contains("_C-") AndAlso fileName.Length = 10 ThenDim newFullName As String = dest & "\" & fileName & ".pdf"File.Copy(file__1.ToString(), newFullName, True)totalFiles += 1End IfNextDim tFiles As Integer = totalFilesCatch ex As IOException End Tryend ifEnd Sub