R
R
Roman_ Outside2015-07-28 14:54:05
Backup
Roman_ Outside, 2015-07-28 14:54:05

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

2 answer(s)
S
Saboteur, 2015-07-28
@new_Roman

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"

M
Max, 2015-07-28
@MaxDukov

to schedule forfiles with parameters?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question