file - Sharing directory in network c# -


i have copy files distant directory in same network. succed access directory :

   string[] parts = regex.split(@directory_path, @"\\");                // l'emplacement de repertoire \\nom de la machine\nomde repertoire              string distant_directory =  @"\\"+environment.machinename+ @"\" + parts[parts.length - 2];             string local_directory = @"stldirectory";             copydir(distant_directory, local_directory); 

the function of copy following :

 public  void copydir(string sourcedir, string destdir)         {             directoryinfo dir = new directoryinfo(sourcedir);             if (dir.exists)             {                 string realdestdir;                 if (dir.root.name != dir.name)                 {                     realdestdir = system.io.path.combine(destdir, dir.name);                     if (!directory.exists(realdestdir))                         directory.createdirectory(realdestdir);                 }                 else realdestdir = destdir;                 foreach (string d in directory.getdirectories(sourcedir))                     copydir(d, realdestdir);                 foreach (string file in directory.getfiles(sourcedir))                 {                      string filenamedest = system.io.path.combine(realdestdir, system.io.path.getfilename(file));                     if (!file.exists(filenamedest))                      file.copy(file, filenamedest, true);                 }             }         } 

but error appears could not find part of path 'stldirectory \ bm529234-crl39-lf.stl' .

  1. why error appears?
  2. how can fix it?

have ensured ever application iis application pool etc has security permissions access directory?


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -