Search For A Solution!

Total Pageviews

Wednesday, March 29, 2017

Delete files in a folder and its subfolders using the command prompt or batch (bat) file. Enable as a task to run automatically...

Steps:

Creat a new txt file.
Rename to yourfilename.bat

Below example will delete all fzip extension files, starting from C:\Users and all subdirectories (it wont search C:\ root)

First line type:

cd C:\Users
##with prompt## del /S /P *.fzip
del /S *.fzip


first line enter your full path to start search
second line use with /P if you need to be prompted or without if you want automatic deletion

Now to run this automatically...

start Task Scheduler
Create a new task
Select to run even if user not logged, select days etc, point to run your previously created .bat file and save it.


No comments:

Post a Comment