Delete Oldest File By Date

  • Re: Delete Previous Files


    Use the "KILL" statement


    Code
    KILL "c:\test.inv"


    To Delete the oldest file, you need to check each of the filenames and divide up the year/month/date... the following code seemed to work when my filename followed the format INV mmddyy.TXT


    Amend the CONSTANTS to suit yourself at the top of the code. For example, I assumed your files were saved with a ".txt" extension.



    By the way, this code will only work until 1st Jan 2020 ::D


    Reminder - this code will delete the oldest file in the folder that has "INV*.TXT" in its filename.


    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!