iterating over multiple types of files?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
pstein
Posts: 125
Joined: 09 Nov 2011 01:42

iterating over multiple types of files?

#1 Post by pstein » 13 Oct 2014 01:31

In a DOS batch script I want to iterate over MULTIPLE (!) types of files.

Therefore I coded:

for /R "D:\work\data" %%a in (*.TXT *.LOG *.DAT) do (
....)

However only *.TXT files are found and processed.
Why not the *.log and *.dat files?

Peter

pieh-ejdsch
Posts: 246
Joined: 04 Mar 2014 11:14
Location: germany

Re: iterating over multiple types of files?

#2 Post by pieh-ejdsch » 13 Oct 2014 02:59

are there log and dat files in it?

Phil

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: iterating over multiple types of files?

#3 Post by foxidrive » 13 Oct 2014 04:09

pstein wrote:for /R "D:\work\data" %%a in (*.TXT *.LOG *.DAT) do (....)

However only *.TXT files are found and processed.
Why not the *.log and *.dat files?


Just agreeing that it works fine.
If the filetypes are there then the error is in how you are processing them, or they are locked.

Post Reply