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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scanning directory

Status
Not open for further replies.

rtnMichael

Programmer
Aug 5, 2002
152
US
hey everyone,
I'm looking for the fastest way to scan a directory for a file. I don't want to go into any other directories that are in there, just search at the top level.

Thanks
M
 
getdents() offers a relative fast solution.


otherwise you can try something like
fopen("my_filename","r")
if it succeeds my_filename is present,otherwise it is not. To make the code even faster you can use the stat() system call.

cheers
amit
crazy_indian@lycos.com

to bug is human to debug devine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top