How to write a script to bat file?

Help to solve the problem.
There is a batch file:
pushd "C:\Test" && (forfiles /d -1 /m *.css /c "cmd /c del /f /q @file")
popd

He removes all the css extension files older than 1 day.
How to finish so he saved the last 2 copies of the file.
Simply put that there is always 2 latest version of the file.

And in my case it turns out that if in a few days no new files appears, you can delete all.
April 7th 20 at 15:50
1 answer
April 7th 20 at 15:52
Solution
It is clear that forfiles for your goals best.
You can use the dir command to sort files in the output. An example I can look at the questionthat was here the other day:
You need to do the bypass on the original files (not copies), then use the above dir to the list of "original file + copies" sorted descending date modified, leave the first 3 files, the rest delete.

If you want details, then describe how and when you have created copies of the files and how are the names of the copies. Where are copies of the original files?
And actually, I would like to understand what you trying to do with this script. Apparently it's something like system of a cyclic backup of the original texts, preserving the last few copies. Why not use git?
Thank you! Figured out
Files of the type .css is a simple chaotic expansion for example.
In fact, the task to remove the old version of backup. bat in the same folder.
Thank you - Ena_Hue commented on April 7th 20 at 15:55
@Berneice.Bernier tell us how you have implemented - Jessyca.Erns commented on April 7th 20 at 15:58

Find more questions by tags cmd/bat