You must Sign In to post a response.
Category: Visual Studio
#767965
Hi,
This can be done in many ways using Vb.NET
First we need to get the File Date and time then we can proceed with the file move.
We can also perform this using directory function.
Thanks,
Mani
This can be done in many ways using Vb.NET
First we need to get the File Date and time then we can proceed with the file move.
string[] files = Directory.GetFiles(dirName);
foreach (string file in files)
{
FileInfo fi = new FileInfo(file);
if (fi.LastAccessTime < DateTime.Now.AddMonths(-1)) // For a Month files
fi.Copy();
//Destination Path with detailed function should come here.
}
We can also perform this using directory function.
Directory.GetFiles(dirName)
.Select(f => new FileInfo(f))
.Where(f => f.LastAccessTime < DateTime.Now.AddMonths(-1))
.ToList()
.ForEach(f => f.Copy());
//Destination Path with detailed function should come here.
Thanks,
Mani
Return to Return to Discussion Forum