title: Manipulate files older than X
body: <p>I've searched a lot how to delete files older than a number X  given but I've only found questions too old to trust.</p>
  
  <p>I have directory filled with files .zip those files are created  to make space but one day i won't have anymore space so i've thought that i can choose a number of days (X) to choose when i want to delete some files and which files i want to delete. At the moment i'm searching for a way to select the files from a folder given that are older than Today - X and tha tdelete them.</p>
  
  <pre><code>void fCamImgCanc(long pThreadId)
  {
  ULARGE_INTEGER rFreeBytesAvailable, rTotalNumberOfBytes, rTotalNumberOfFreeBytes;
  if(sys.Logs.CamImgSave &amp;&amp; sys.Logs.ImageSMod == 1)
  {
  if (::GetDiskFreeSpaceEx ("C:\\S\\LOGBOOK\\Cam\\Logfold", &amp;rFreeBytesAvailable, &amp;rTotalNumberOfBytes, &amp;rTotalNumberOfFreeBytes))
  {
    if (rTotalNumberOfBytes.QuadPart &lt; ((rTotalNumberOfBytes.QuadPart * sys.LogB.FreeSpaceOnDisk) / 100))    //if disk size &lt; __% delete the older day
    {                                                                                                         
      do
      {
              //Date of the oldest group of files         &gt; Today -  sys.LogB.OlderThanD setted for example to 13
        if("C:\\S\\LOGBOOK\\Cam\\Logfold\\FilenameData" &gt; Today - sys.LogB.OlderThanD)   
        {
          DeleteFile("C:\\S\\LOGBOOK\\Cam\\Logfold"); 
        }
      }while(rTotalNumberOfBytes.QuadPart &lt; ((rTotalNumberOfBytes.QuadPart * sys.LogB.FreeSpaceOnDisk) / 100)); //free space till we have the space that we need
    }
  fAddOnZip("C:\\S\\LOGBOOK\\Cam");   
  }
  }
  else  //ImageSMod = 0 -&gt;  Relative "save of the images of the lot and at the next lot delete of them"
  {
   DO OTHER THINGS
  }
  }
  </code></pre>
  
  <p>I've got the delete function and the zip function yet</p>