-1

I want to know how to open all files with a specific extension like all .txt or .html files

within the same directory where my .exe file exsits and all its sub directories

the os is always windows..

thx in advance

UPDATE :

I wanna know how to :

1- list all files of specific extension within current directory.

2- list all sub directories.

Merna
  • 269
  • 1
  • 5
  • 14
  • What have you tried? What are you having trouble with? Are you asking how to loop through files in a directory? How to open a file? What does "open" mean? – SLaks Aug 14 '13 at 18:05
  • This is one of those questions where you think, "what..." but in reality it is a really good question for a Windows programmer. I don't know if the given answers work in *nix? Thanks, and I vote +1 on this **stealth** question. – JackCColeman Aug 14 '13 at 18:48
  • Does 2. mean "all subdirectories", "all subdirectories with the extension .txt or html", "all subdirectories that *contain* (one or more) txt/html files", or is it just an extension of 1. and you want to see all files with a certain extension in the starting *and* sub directories? – Jongware Aug 14 '13 at 20:05
  • The pieces of this question are all answered elsewhere. [Find what directory the running process EXE is stored in](http://stackoverflow.com/q/3364589). [Find all txt files in a directory](http://stackoverflow.com/q/2201888/). [Recursively traverse a directory](http://stackoverflow.com/q/2038912/). [How to launch the associated application for a file](http://stackoverflow.com/q/13766969/). – Raymond Chen Aug 14 '13 at 20:19

1 Answers1

1

Look at FindFirstFile() and FindNextFile() in the MSDN documentation

Start with http://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx

Then look at http://msdn.microsoft.com/en-us/library/windows/desktop/aa364428(v=vs.85).aspx

Jeff Loughlin
  • 4,134
  • 2
  • 30
  • 47