Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7420275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:12:36+00:00 2026-05-29T08:12:36+00:00

Can someone guide me on a possible solution? I don’t want to use /bin/cp

  • 0

Can someone guide me on a possible solution? I don’t want to use /bin/cp or any other foreign apps. I want my program to be independent. Also I know that every system is quite specific, so I’m interested in UNIX/Linux compatibility.

How can I solve it? Just going down the source directory and creating a new directories in the target one and copying files in them, or there is a better solution?

BTW my goal is: copy all first level subdirs recursively into target dir if they are not present there

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:12:37+00:00Added an answer on May 29, 2026 at 8:12 am

    You really need some kind of recursive descent into the directory tree. Doing this, you can actually make this very portable (using opendir/readdir on Linux and FindFirstFile/FindNextFile on Windows). The problem that remains is the actual copying. You can use the C standard library for that with the following algorithm:

    • Open source file
    • Open target file
    • In a loop, fread a block of constant size from the source, then fwrite it to the target. Stop if the source file contains no more data

    Hope this helps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is that possible? I would be happy if someone can guide me where in
can someone guide me? Is it possible to get information of .class file (in
Can someone guide me towards some good opensource project management tools? I need it
Can someone tell me, where to find a detailed guide, how to build the
I need someone to lead/guide me where have I code wrongly because I can't
Can someone please explain how Read/Show works.. I cannot find any tutorials on it.
Possible Duplicate: Where can I learn web programming from start to mastery? I want
Can someone guide me to find the best storage format in term of read/write
Can someone guide me in the right direction on how to implement and at
Can someone guide me how I can create a custom linux system in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.