I have a batch code which cleans files which are older than 15 days. But I want to only delete files that end with '_C' and they have no extension.
Here is my code:
SET mypath=%cd%/downloads
ForFiles /p %mypath% /d -15 /c "cmd /c For /R %%A in (*_C.*) Do (del /q @fname)
Here are my files:
File Name: ---------Date:
A_C_123_C ------ 18.02.2019
A_C_456_C ------ 01.01.2018
A_C_789_C ------ 01.01.2018
Testfile------------- 01.01.2018
tmp.txt ------------- 01.01.2018
When I execute the code, it cleans Testfile also. I just want to delete extensionless files that end with '_C' and older than 15 days.
What should I do?