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 Mar 10, 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 Files Deleted by CHKDSK [2023 Update]

Data files lost after running CHKDSK scan? CHKDSK delete your files? This page shows you how to undelete or recover files deleted by CHKDSK with simple steps by yourself using powerful and easy-to-use Windows file recovery software.

Dany

Mar 10, 2023

How to Delete Hacker Files to Free Up Space on Windows

Virus attacks and malware may cause chaos on your computer, and you may not be able to delete some files. We will help you remove the files with CMD and show you how to format the hard drive.

Dany

Feb 22, 2023

How to Recover Deleted Files on Windows 10 in 2023

If you deleted some files on Windows 10, you should go check the Recycle Bin immediately. If you cannot find them in the Recycle Bin and the File History is not enabled, you can try the methods we mentioned in this short passage.

Dany

Mar 09, 2023

How to Recover Crashed Excel Files or Restore Its Previous Version

This post includes complete solutions to help you perform Microsoft Excel file recovery. If you accidentally deleted Excel files, lost an unsaved Excel file, or Microsoft Excel 2016 crashed on saving or opening files, relax. Follow the fixes here to restore your lost Excel files with ease now.

Dany

Mar 10, 2023

How to Recover Deleted Adobe Premiere Files on Windows

This article offers two methods to recover deleted Adobe Premiere files on Windows, one with software and one without. If you have the same problem, you can find the solutions to fix the issue.

Dany

Apr 25, 2023

How to Delete Files Older Than 90 Days and Save A Copy

You may free up space and keep things organized by only deleting files in any folder that is older than a specific number of days. If you have many files in separate directories and want to clear them up by eliminating those older than a particular number of days, you can use the ForFiles command.

Dany

Feb 22, 2023