title: Copy PDfs Files to shared network and files corrupted
body: <p>My app Windows forms .NET in Win XP copy files pdfs in shared network folder in a server win 2003.</p>
  
  <p>Admin user in Win2003 detects some corrupt files pdfs, in that shared folder.</p>
  
  <p>HOw can I check if a file is copied right in shared folder ??</p>
  
  <p>the code: I use two ways to copy/move files to shared folder</p>
  
  <ol>
  <li><p>NOte: my app generates PDFs files</p></li>
  <li><p>Write Bytes to disk (the shared folder)</p>
  
  <p>Public Shared Function GenerarFicheroDeBytes(ByVal datosFichero As Byte(), ByVal rutaFisicaFichero As String) As FileStream</p>
  
  <pre><code>If Not Directory.Exists(Path.GetDirectoryName(rutaFisicaFichero)) Then
      Directory.CreateDirectory(Path.GetDirectoryName(rutaFisicaFichero))
  End If
  
  Dim fs As New FileStream(rutaFisicaFichero, FileMode.OpenOrCreate, FileAccess.Write)
  fs.Write(datosFichero, 0, datosFichero.Length)
  fs.Flush()
  fs.Close()
  Return fs
  </code></pre>
  
  <p>End Function</p></li>
  </ol>
  
  <p>2 Move File to shared network folder</p>
  
  <pre><code>Public Function MoverFicheroABuzonParaIndexar(ByVal rutaProcesarFicherosBuzon As String, ByVal nombreFichero As String) As String
  
  Dim nombreFicheroPDF As String = String.Empty
  Dim nombreFicheroPDFRenombrado As String = String.Empty
  Dim nombreFicheroBuzon As String = String.Empty 
  
       nombreFicheroPDF = ... Path.GetFileNameWithoutExtension(...)
       nombreFicheroBuzon = ObtenerRutaFicheroBuzonParaIndexar(...)
  
        File.Move(nombreFicheroPDF, nombreFicheroBuzon)
  Return nombreFicheroBuzon
  
  End Function
  </code></pre>