Answer the question
In order to leave comments, you need to log in
How to delete files and folders on a schedule?
Good afternoon,
tell me how to regularly delete folders and files whose creation date exceeds 7 days?
Answer the question
In order to leave comments, you need to log in
Write a script in any scripting language.
since 2007 Windows has a built-in utility that allows you to process files by mask and date
forfiles.exe /p path_to_folder /s /m *.* /d -7 /c "cmd /c del /q /f @file"
You can first execute this command to list files older than 7 days:
forfiles.exe /p path_to_folder /s /m *.* /d -14 /c "cmd echo @file is too old and will be removed"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question