I need to copy files from one directory to another on a daily basis. I want to keep one weeks worth of files. How can i read the timestamp to determine which is the oldest file so i can delete it?

Hi, you can use
File.GetCreationTime (Path) to get the File creation time.

Ex

MessageBox.Show(File.GetCreationTime("C:\\Path.txt").ToString ());

Then Check the Date and Time If it old then delete or move it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.