Del txt files in directory

August 20, 2011 at 05:51:19
Specs: Windows 7
How can I use batch file to find and delete all *.txt files in a specific directory?
I have a folder with a several sub directories. I want to find txt files in theses directories and delete them.

Thnaks
Ho


See More: Del txt files in directory

Report •

#1
August 20, 2011 at 08:41:16
Try this:

CD <Your Directory Name Here>
DEL *.TXT*
CD <Your Directory Name Here>
DEL *.TXT*

and so on...
The batch file will start in the directory that you store it in, then enter in a directory in that folder for the batch to dive in.

Let me know how it works...

Mouse could not be found. Click OK to continue.
What to do now?


Report •

#2
August 20, 2011 at 10:14:20
Thanks for your reply...
I have numerous folders and branches, some hundreds! is it any way to delete all txt files by one or few commands, instead of calling each directory one by one?
this is the example of my folder:

C:\D1_1\D1_2\D1_3\D1_4\file.txt
C:\D1_1\D1_2\D1_3\D2_4\file.txt
C:\D1_1\D1_2\D1_3\D3_4\file.txt
.
.
.
C:\D1_1\D1_2\D2_3\D3_4\file.txt
.
.
.
C:\D1_1\D2_2\D1_3\D3_4\file.txt
.
.
.
I want to create a batch file in "C:\D1_1", and delete all txt files in all sub folders.
In windows I can do it by just write *.txt in the search box and delete all the founded items... I need such an operation with batch file...

Many Thanks



Report •

#3
August 20, 2011 at 10:47:13
What about this:

DEL /S *.TXT*

Just that one line should delete all text files in the sub directories. Does this work?

Mouse could not be found. Click OK to continue.
What to do now?


Report •

Related Solutions

#4
August 20, 2011 at 11:42:56
Great! It works... Thanks a lot

Report •

#5
August 20, 2011 at 11:53:10
Glad to hear it.

Mouse could not be found. Click OK to continue.
What to do now?


Report •

Ask Question