|
||
|
|
#2 (permalink) |
|
Forum Expert
|
Code:
string name == "";
while ( !name.Contains("."))
{
Console.WriteLine("Please enter a file name: ");
name = Console.ReadLine();
}
List<string> paths = new List<string>();
paths.AddRange( Directory.GetFiles( "C:", string.Format("{0}", name), SearchOption.AllDirectories ) );
__________________
Procrastinators unite!
Tomorrow. Saying that Java is nice because it works on all OS's is like saying that anal sex is nice because it works on all genders. ![]() |
|
|
|
|
|
#3 (permalink) | |
|
RunUO Forum Moderator
|
Quote:
Also this code doesn't make sure the file is an executable (for example I want to run file "run.me.exe" and I insert by accident "run.me", the code will look for the wrong file). Considering you want to execute the file then this code will do the job intended. However, I wanted to point out those things in case anyone else will want it to do a file search in general and will grab this code as is. In any case good job Killamus, keep it up ![]()
__________________
I always try to help
![]() Sometimes, I don't know how.... ![]() My Web Page Forum Rules ------------------------------------------------------------- Extensive OWLTR System | Token System | World Teleporters ------------------------------------------------------------- |
|
|
|
|
|
|
#4 (permalink) |
|
ConnectUO Creator
Join Date: Jan 2004
Age: 27
Posts: 4,822
|
you can use DirectoryInfo.GetFiles(), this function allows a search parameter such as *.txt or myfile*.txt and so on.
__________________
Jeff Boulanger ConnectUO - Core Developer Want to help make ConnectUO better? Click here to submit your ideas/requests Use your talent to compete against other community members in RunUO hosted coding competitions If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team. Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|