Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

code to find a file in linux

Status
Not open for further replies.

wezel

Computer
Sep 30, 2002
3
0
0
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
 
Replies continue below

Recommended for you

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.
Back
Top