Task Scheduler : How to delete files older than X days automatically - windows command prompt

preview_player
Показать описание
On Windows 10, you can use Command Prompt and Task Scheduler to automatically delete files older than a certain number of days to free up space and keep your files organized.

command :
ForFiles /p "C:\path\to\folder" /s /d -30 /c "cmd /c del /q @file"

you can also filter files search with /M *.docx to delete only docx files.

#taskscheduler
#windows10
#windows11
#autodelete
#commandprompt
#forfiles
#tutorial
#trick
#tips
#automation
#deletefile
Рекомендации по теме
Комментарии
Автор

Best share very informative Share thanks my friend Stay safe keep uploading

aaronandreiofficial
Автор

very nice video information sharing bosku

LintangSarahChanel
Автор

Hadir sobatku dari Indonesia... 👍🏿👍🏿👍🏿👍🏿👍🏿 Semoga sukses selalu

sapengvlog
Автор

Hdr support kk slm sukses Amin s'mga bertambhaju channel ny kk👍💯

naninga
Автор

Thank you for your demo. It was very helpful

lingarajhulikeri
Автор

thanks for sharing vedio very helpful for me

kencrutchannel
Автор

Hello!
Can you please tell me what parameter should be added to this task so that not only the files are deleted, but also the empty directories behind them, if any are left?
and also, so that when you perform this task to delete files and directories, they are deleted to the trash, not permanently?
this is necessary in case of restoring a file/directory, if the user has submitted a request after some time (we ourselves will clean up the recycle can manually once a week, if no user has submitted a request to restore the file/directory during this time).

nicromatic
Автор

If I have screenshots which I want to delete for exmaple at the end of each month, will the forfiles actually delete them since it has to be modified? since the screenshots may only be opened but not modified? Will that mean it wont delete then or it will still work as normal and delete them no matter what?

kazxyy
Автор

Hey so when I ran the command to delete the folder based on its name it just delete the files inside of it but how do I delete the folder itself?

MedFN
Автор

Hi. What if, the date of folder is refering to the bame of folder imstead of the modified date? Can we delete it based on the folder name?

msyaiful
Автор

came here after getting so lost on an article tutorial bc the explanation was like objectively bad

Ilovebrushingmyhorse
Автор

Can also delete folder? If can, how? Newbe

rokeyjunior
Автор

Use force command

Example del /s /f

Make sure the folder is owned by the delete user

vasanthkumar