0

I am currently making program in C and linux. This program allows me to copy file from current directory to another directory or copy the file and paste it in current directory

E.g.: My program is call copy and i have a folder name Folder and file name FILE

If i type: ./copy FILE FILE2. A new file name FILE2 will be create in current directory.

If I type: ./copy FILE Folder A new file name FILE will be create in Folder directory

Is there a way to check the second argument to see if it's a FILE name or a directory because i want the program to determine which function to run when the argument is received.

Can this be done without using any other function. (Which is only using creat() and open() function)

Thank you all in advance.

mmm
  • 7
  • 7
  • That behavior is already built-in to most shells, why do you need a separate program? – l'L'l Apr 28 '17 at 17:28
  • well, using cp can be easy, but making one can be challenging and in some case, these function needs to be rebuilt or built. – mmm Apr 28 '17 at 17:39

0 Answers0