I need to create a C program that will copy one folder content to another.
The folder and destination will be provided by the user.
I need it to be in C ’cause I’m gonna run it on terminal.
Thanks in advance for any help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t need to write it in C because it is going to run on a terminal. BASH (on Unix) or PowerShell (on Windows) are ideal tools for what you are trying to accomplish.
If you absolutely must write it on C the answer would depend on whether you are allowed to run external processes within your C program or not.
If you are allowed to run external processes, then use
execvor one of its relatives to launch an externalcpprocess to do the task for you.If you are not allowed to run external processes, then you will have to write a C program to recursively copy your directory contents. That program will depend on the platform you are targeting.