How to Delete Files Older Than X days Automatically

I'm attempting to devise a method to automatically enforce our policy of deleting data from our FTP sites after 30 days. Titan FTP is running on Windows Server 2008 R2 Datacenter. I first asked Titan if they had a feature that could do this automatically. They don't, so I went to a third party. Does anyone know of an application or script that would meet these criteria?

Best Answered by

Dany· Answered on Jan 06, 2023

If you wish to automatically delete files older than X days in Windows 11 and Windows 10, follow these steps. Using Storage Sense and the Windows command line, you can delete all files older than a certain number of days from your computer. This post will teach you how to delete files older than X days ( 7, 10, 30, etc.) in Windows 11/10 using Storage Sense or the ForFiles command line.

Follow these procedures to automatically delete files older than X days in Windows 11/10 using Storage Sense:

  • To open Windows Settings, hit "Win+I".
  • Navigate to System - Storage and then to Storage Sense.
  • Toggle the button for Automatic User Content Cleanup.
  • Select an option from the Run Storage Sense menu.
  • Run Storage Sense now by clicking the button.

It is recommended that you select a time that is convenient for you. You can select Every day, week, or month for your information. After that, click the Run Storage Sense now button. It will remove all files that are older than the specified time.  However, the issue with Storage Sense is that you cannot select a specific folder.

You can also delete files older than X days with ForFiles Command. Follow the given steps below to use CMD to delete files older than x days:

  • In the Taskbar search box, type cmd
  • Select the Run as administrator checkbox
  • Select the "Yes" option
  • Enter the command: ForFiles /p "folder-path" /s /d -30 /c "cmd /c del /q @file"

The Windows auto-deletion feature will remove your files automatically. If you enable auto-delete files older than  30 days in Task Scheduler, your data will be deleted automatically. You may be interested in learning how to stop Windows 10 from automatically deleting and recovering deleted files on Windows. Unfortunately, most customers cannot retrieve such files manually, leaving them with only one option: utilize a data recovery application. If you need dependable data recovery software, we propose EaseUS Data Recovery Wizard.

The data recovery software can effortlessly recover lost files whether you deleted them using Storage Sense or ForFiles Command Lines. This professional recovery tool is also useful for home users.

Relative Article: How to Delete Files Older Than X Days on Windows 11/10 with File Explorer, CMD, PowerShell

Use EaseUS Data Recovery Wizard to recover deleted or lost files easily and quickly.

Tutorials on how to recover lost, deleted, or formatted data from HDD, SSD, USB, SD card, or other storage media on Windows and Mac.

People Also Ask

How to Recover Deleted Items with Windows File Recovery

Some files you cannot recover from the Recycle Bin can be recovered with third-party data recovery software or Windows File Recovery. Keep reading to learn the details.


Jan 03, 2023

How to Delete Files from Archive by Text File

Renaming a file within a zip bundle is similar. Even in these circumstances, you can extract everything before zipping it back into a new file or overwriting the old one. So, keep reading this post to acquire the 2023 guide.


Jan 05, 2023

How to Fix It Takes a Long Time to Delete Files in Windows

Why does Windows take so long to delete files and clear the recycle bin? This problem will occur when I am trying to delete plenty of small files on Windows. How can I fix this Windows issue?


Dec 27, 2022

How to Delete Files Older Than 30 Days with PowerShell

You can delete files older than 30 days with PowerShell, and there are other solutions to delete these files. We will introduce all the possible ways in this passage.


Jan 06, 2023

How to Delete Subfolders and Files by GPP

You can overcome this problem by configuring a subfolder item by GPP. Using the GPP options, you can configure a subfolder to a file system object. Before creating a subfolder preference item, you should investigate the behavior of each type of action supported by this extension.


Jan 06, 2023

Need a Deleted File Recovery Tool for Windows XP

While uninstalling a program on your computer or laptop, it is easy to lose files. You will need a data recovery program if you cannot find your lost files in Recycle Bin. We will recommend EaseUS Data Recovery Wizard to help you recover the deleted files on Windows XP.


Dec 29, 2022