Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

code to find a file in linux

Status
Not open for further replies.

wezel

Computer
Joined
Sep 30, 2002
Messages
3
Location
JM
i need to write some code to find a given executable file and run it but i'm not sure how to to go about it
 
The code depends, of course, on your platform O/S. On UNIX, you can take advantage of the system *find* command to search for a wildcard-spec filename. On Windows, you could use the DOS find command, but it can't take wild cards (and is incredibly klunky to boot). Your best bet there is to roll your own in DOS or Windows using the findfile and nextfile system calls (or the MFC/Delphi equivalents) to walk a directory, and then apply that recursively to walk the directory trees. On DOS/Windows you'll also need code to find the disk partitions so you can traverse that list as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top