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.