hi

i use this code to copy files from one dir to another:

                DirectoryInfo diSource;
                DirectoryInfo diTarget;
                
                diSource = new DirectoryInfo(txtFrom.Text);
                diTarget = new DirectoryInfo(txtTo.Text);
                if(!diSource.Exists || !diTarget.Exists) {
                        Console.WriteLine("dir does not exist");
                        return;
                }
                
                foreach(FileInfo f in diSource.GetFiles()) {
                        try
                        {
                                        //copy
                                        Console.WriteLine("copying " + 
f.FullName 
                                                + " to " + diTarget.FullName);
                                        f.CopyTo(diTarget.FullName);
                        }
                        catch(IOException er) {
                                Console.WriteLine("copy failed " + er.Message);
                        }
                }

but it prints:
copying /home/lars/temp/test1/testfil to /home/lars/temp/test2/
copy failed Win32 IO returned 82. Path: /home/lars/temp/test1/testfil" or
"/home/lars/temp/test2/

why?

i am running ubuntu with latest version from repository (then why is it
talking about win32?). get this result on all versions i've tried.

any other ways of copying/moving files?
-- 
View this message in context: 
http://www.nabble.com/error-on-FileInfo.CopyTo%28%29---.MoveTo%28%29-tf3255821.html#a9051683
Sent from the Mono - General mailing list archive at Nabble.com.

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to