what is a command that i can use to make a prog search the entire hd for a file...? but a need a command that i can use in linux to.. .. please can you show me a simple example on how to use the command cause im a comple nebie to c..
what is a command that i can use to make a prog search the entire hd for a file...? but a need a command that i can use in linux to.. .. please can you show me a simple example on how to use the command cause im a comple nebie to c..
Win 98 has find.exe, which searches the hard drive, and is 7k in size.
heh! hhmm maybe i post it wrong... what i mean is... what command can i use that workz in linux(gcc)and in windowz compilar(boland) i really need it more for linux.. then window.. btw... sorry for posting it here i didnt know that there was a board on linux programming here...
This will find any file "filename" on your system, provided that you have permission to read the chain of directory entries starting from the given directory (in this case / i.e., the root):
find / -name filename
As an alternative (more likely that you want this) you can search only the home directory of the current user:
find ~ -name filename
There is also a command that uses a cache file, which is usually updated only once a day, but also is much faster:
locate \*/filename
(here \* stands for any number of character, / for the last path separator, and filename for the file you are looking for)
if you are trying to find where a command program is on your system you should use:
which filename
Hope one of these is what you are looking for...
alex
How do u do that in windows? Is there a special command?
You don't..
find under *NIX is not available under DOS/Windows unless you get something like the Cygwin GNU tools.
To my knowledge there is no command line tools that share a similar interface between *NIX and Windows.
You could write your code to conditionaly compile different calls to the native "find" command to match the particular OS you are operating under at that time.
Hi!
In dos: dir c:\ /s /b
will give you a listing of all files on the c:-drive.
If you happen to use the borland C compiler (the free version or you have installed the command-line interface to the commercial versions) then you also get the grep utility:
dir c:\ /s /b | grep -i -r+ -e \\filename$
will give of all occurences of "filename"
Hope this helps...
alex
Hi!
now you can read the file´s path out of "path.out".Code:system("find / -name filename >path.out");
klausi
When I close my eyes nobody can see me...