Computing.Net > Forums > Disk Operating System > batch: iterating through all files in a dir

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch: iterating through all files in a dir

Reply to Message Icon

Name: SlowJoe
Date: December 7, 2000 at 02:00:21 Pacific
Comment:

Hello,
I'd like to use a program, that needs a single file as parameter. Im my directory there are lot's of *.java-files I want to use the program with. Could anyone tell me how is the syntax for iterating through all files and run the program in every step?
I thought of something like:
foreach (*.java)
{
program $_;
}
(a little perl-like ;) )

Thanks in advance,

slowjoe



Sponsored Link
Ads by Google

Response Number 1
Name: Ginger Grant
Date: December 7, 2000 at 04:45:11 Pacific
Reply:

How about:
for %%a in (*.java) do program$_ %%a


0

Response Number 2
Name: slowjoe
Date: December 8, 2000 at 07:42:54 Pacific
Reply:

Thank you, Ginger!

That does the work as expected. By the way "$_" is a standard variable in Perl. In my perl-like code snippet it should represent the parameter that is given to the program "program".

slowjoe


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: batch: iterating through all files in a dir

How can I rename all files in a directory ? www.computing.net/answers/dos/how-can-i-rename-all-files-in-a-directory-/2201.html

Batch for processing all files in a Dir. www.computing.net/answers/dos/batch-for-processing-all-files-in-a-dir/10802.html

batch file - rename variable www.computing.net/answers/dos/batch-file-rename-variable/13494.html