Alex Rivera | Logout

Iterate all files in a directory using a 'for' loop

Asked 2008-09-26T09:42:34.160
467

How can I iterate over each file in a directory using a for loop?

And how could I tell if a certain entry is a directory or if it's just a file?

Edit
Report

1 Answer

3

The following code creates a file Named "AllFilesInCurrentDirectorylist.txt" in the current Directory, which contains the list of all files (Only Files) in the current Directory. Check it out

dir /b /a-d > AllFilesInCurrentDirectorylist.txt
answered 2010-09-28T09:21:02.290

Your Answer