title: SHFileOperation - File only copy
body: <p>Here is some code that transfers the contents of the A drive into C:\test\disk1. The program compiles and runs fine. The program creates a folder called "Floppy disk drive (A)" and the contents are contained within. Is it possible to just copy the files from the A drive without the folder?</p>
  
  <pre><code>#include &lt;Windows.h&gt;
  #include &lt;stdio.h&gt;
  
  int main(int argc, char ** argv)
  {
      const wchar_t *const sourceFile = L"A:\\\0";
      const wchar_t *const outputFile = L"C:\\test\\disk1\0";
  
      SHFILEOPSTRUCTW fileOperation;
      memset(&amp;fileOperation, 0, sizeof(SHFILEOPSTRUCTW));
  
      fileOperation.wFunc = FO_COPY;
      fileOperation.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_FILESONLY;
      fileOperation.pFrom = sourceFile;
      fileOperation.pTo = outputFile;
  
      int result = SHFileOperationW(&amp;fileOperation);
      if (result != 0)
      {
          printf("SHFileOperation Failure: Error%u\n", result);
          return 1;
      }
  
      memset(&amp;fileOperation, 0, sizeof(SHFILEOPSTRUCTW));
  
      printf("Transfer complete\n");
  
  }
  </code></pre>