Scripting Languages
--
Questions
--
Followers
Top Experts
But I would like to delete the files before a certain date (created).
can I specify a range ?
let's say delete files between 10Jan and 14Jan
thanks.
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Might also be worth looking at https://www.experts-exchange.com/questions/20947290/Delete-All-Contents-of-Folder-Older-than-7-Days.html.
SET DIRECTORY=c:\temp
:: To test use ForFiles /p %DIRECTORY% /S /M *.* -d -16/09/2008 -c "cmd /c @echo @path"
ForFiles /p %DIRECTORY% /S /M *.* -d -16/09/2008 -c "cmd /c @del /q @path"
  :
  CALL delrange 26/01/2008 28/02/2009
  :
NOTE: I've condensed the last line.... otherwise it's the same as the code above.
@echo off
setlocal enabledelayedexpansion
set d1=%1
set d2=%2
set d1=!d1:~6,4!!d1:~3,2!!d1:~
set d2=!d2:~6,4!!d2:~3,2!!d2:~
for %%a in (*.*) do (
  set fn=%%a
  set fd=%%~ta
  set fd=!fd:~6,4!!fd:~3,2!!fd:~
  if !fd! GEQ !d1! if !fd! LEQ !d2! del !fn!
)






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Scripting Languages
--
Questions
--
Followers
Top Experts
A scripting language is a programming language that supports scripts, programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled). Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), embedded systems, as well as numerous games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language.