title: C code to Sync Flash Drives
body: <p>Just as a learning experience, I'm trying to code the following problems in C.</p>
  
  <blockquote>
    <p>If two flash drives are inserted each having a folder (say,
    Course_Notes), then they get synced. That is, data is copied from one
    to the other and if there a file already exists, then the newer one is
    retained.</p>
  </blockquote>
  
  <p>I would do this in bash by:</p>
  
  <pre><code>#!/bin/bash
  while $1
  do
  cp -ur /media/PD_1/Course_Notes /media/PD_2/Course_Notes
  cp -r /media/PD_2/Course_Notes /media/PD_1/Course_Notes
  done
  </code></pre>
  
  <p>How do I do this in C without too many <code>system</code> calls ?</p>