I am working on a C project and I am trying to find the oldest file within a directory so that that once the oldest file has been found, it is then deleted. I can not find anything on how to do this in C using windows, have found ways to do it in Linux but I need a version for Windows.
Share
You’ll want to use the
FindFirstFile/FindNextFilecombination on Windows to get the files in the directory. You can then either usestatas you would in Linux, orGetFileAttributesExto check the dates.