title: Detect OS from attached USB, copy folders/files accordingly
body: <p><strong>The problem:</strong> I have a USB, that can be plugged into different machines <em>(Windows, Linux, MacOs and Android)</em>. Without installing any script to these machines; I need a script to copy all files and folders <strong>from a given folder name</strong> (sfolder) which is always the same and at a given location on these machines, <strong>to this USB</strong> and send some signal to the com port.</p>
  <p>I can write a simple windows batch file to copy the files and send some text to a given com port. Or some mini c++ code using SHFileOperation and COM to do the same thing. <em>(works)</em></p>
  <p>I can also write a bash file for linux (and am guessing that the command cp will be more or less the same for MacOS / Android) to do the same thing.. <em>(works)</em></p>
  <p>Any idea on how to detect different Operating Systems? via C/C++ or Batch / Bash files through autorun.inf?</p>
  <p><em>p.s. this is some hardware that acts like a usb drive, which switches between connected and not connected at random intervals, acting like a one-way folder/file collector for an isolated non-network NAS.</em></p>