using C to copy a file ...

Hi mates,
I have created a shell of my own and one of the built in functions is COPY. This command is supposed to check the availability of a command in a specific direcotry and if the command is available chnage its extension to old. my problem is that how can i search for that specific file in the direcotry. assume that i have 2 arguments on for source file and another for distination file.

an example will be appreciated.

abdul

For reading directories in C use the following
library calls:
opendir(3), readdir(3), closedir(3), rewinddir(3), seekdir(3), telldir(3), scandir(3)

For renaming check out:
link(2), unlink(2), rename(2)