Delete all files except the most recent via command line, script or CMD.EXE?
It is easy to delete all files except the most recent via command line, script or CMD.EXE (for Windows 11, 10, ... and MS Server)!
The most popular script to delete, for example, all files with the extension *.txt and to keep the latest 7 files, which can then be easily automated via autostart or the scheduler under Windows, or can be executed directly via the address bar of Windows Explorer!
That is different. If it is a script, I can certainly adapt it myself; if a compiled program, there should be an input option for the file type.
I have several programs that save backup or log files to directories on a daily basis. I have such a mini program DelAge32.exe, which all files older than z. B. deletes 7 days. That works fine, except when I'm not at the computer for more than 7 days. Then the directory is empty when you start up for the first time. So I'm looking for a tool that will leave the last 7 files untouched and delete all older ones. Have I now described it clearly?
There are some tools that delete files older than a certain date, also via the command line. I'm looking for something that will delete files except for the most recent ones. Probably not a lot of programming effort for professionals?
You don't need any programming knowledge for this. So, data in a folder should be deleted that are younger than xxx days - hours?