You can delete files by date in Windows 10 and 11 manually using File Explorer, or automatically using the Command Prompt (ForFiles), PowerShell, or Storage Sense.
Method 1: Manually via File Explorer (Best for one-time deletion)
File Explorer allows you to search for files matching specific dates or date ranges across folders and subfolders. Open File Explorer by pressing the Windows Key + E. Navigate to the specific target folder. Click into the search bar in the upper-right corner.
Type a date syntax parameter to instantly filter your files:
Specific range: datemodified:2025-01-01..2025-12-31 (Finds files modified in the year 2025)
Before a date: datemodified:<2026-01-01 (Finds files older than January 1, 2026)
After a date: datemodified:>2026-05-01 (Finds files newer than May 1, 2026)
Select the results by pressing Ctrl + A once the search finishes loading.
Delete the files by hitting the Delete key (or Shift + Delete to bypass the Recycle Bin completely).
Method 2: Command Prompt via ForFiles (Best for batches older than X days)
The ForFiles utility is ideal if you need to quickly clear out data older than a strict number of days across deep subfolders.
Open the Start Menu, type cmd, and select Run as administrator.
Execute the command below (replace C:\YourFolder\Path with your actual directory and -30 with your target day count):
ForFiles /p “C:\YourFolder\Path” /s /d -30 /c “cmd /c del /q @file” Use code with caution. /p targets the base path directory. /s forces the command to loop into all child subfolders. /d -30 targets items older than 30 days.
/c “cmd /c del /q @file” executes a quiet delete operation on matching files. Method 3: PowerShell (Most precise control)
PowerShell provides safe structural filtering when handling target age thresholds across large system directories.
Batch file to delete files older than N days - Stack Overflow
Leave a Reply