c# - Runtime error 'Could not find a part of the path' E:\ -


I tried copy folder from flash disk to c: directory. Sometimes it's running properly, but sometimes I get an error:

Path E: \ debug \ VIP

This problem Have any idea about? Here's my code:

  string source_dir = "E: \\ debug \\ Vip"; String destination_dir = "C: \\ Vip"; If (! System.IO.Directory.Exists (destination_dir)) {System.IO.Directory.CreateDirectory (destination_dir); } // sub-location destination_dir is to remove the full path (e: \). // Directory Create sub-directory structure in Destination Forex (Directory_dir + dir.Substring (source_dir.Length)) in the gate directory (Source_Dire, "*", System.IOS Searchoption.All Directories);} Foreach (string file_name Directory.GetFiles (source_dir, "*. *", System.IO.SearchOption.All Directories)) {File.Copy (file_name, destination_dir + file_name.Substring (source_dir.Length), true);}   

Use to join the paths.

For example directory Naaa Directory (System.IO.Path.Combine (destination_dir, dir.Substring (source_dir.Length)));

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -