korasoglu Posted January 20, 2016 Share Posted January 20, 2016 (edited) Arkadaşlar seçilen klasörü istenilen konuma nasıl kopyalayabilirim. folderBrowserDialog1.ShowNewFolderButton = true; DialogResult result = folderBrowserDialog1.ShowDialog(); if (result == DialogResult.OK) { string source = folderBrowserDialog1.SelectedPath; string target = Application.StartupPath + @"\Kategori\" + combo.Text + "\\"; Directory.Move(source, target); } burada hata nerede anlamadım ama halen var olan bir dosya oluşturulamaz diye hata veriyor. Edit : string source = folderBrowserDialog1.SelectedPath; string target = Application.StartupPath + "\\Kategori\\" + combo.Text; Directory.Move(folderBrowserDialog1.SelectedPath, target + "//deneme"); bu şekilde isim değiştirerek taşıdı ama benim istediğim kopyalanmasıydı. Edited January 21, 2016 by korasoglu Quote Link to comment Share on other sites More sharing options...
abdullahTR Posted January 20, 2016 Share Posted January 20, 2016 http://www.kodlamamerkezi.com/c-net/c-ile-dosya-ve-klasor-islemleri/ Quote Link to comment Share on other sites More sharing options...
korasoglu Posted January 21, 2016 Author Share Posted January 21, 2016 Vatandaş orada yazmış zaten dosya tamamda klasör kopyalatamıyorum yardım diye yinede tşk ederim. Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted January 21, 2016 Editor Share Posted January 21, 2016 private void copyDirectory(string strSource, string strDestination) { if (!Directory.Exists(strDestination)) { Directory.CreateDirectory(strDestination); } DirectoryInfo dirInfo = new DirectoryInfo(strSource); FileInfo[] files = dirInfo.GetFiles(); foreach(FileInfo tempfile in files ) { tempfile.CopyTo(Path.Combine(strDestination,tempfile.Name)); } DirectoryInfo[] directories = dirInfo.GetDirectories(); foreach(DirectoryInfo tempdir in directories) { copyDirectory(Path.Combine(strSource, tempdir.Name), Path.Combine(strDestination, tempdir.Name)); } } Bu methodu yapıştırın daha sonra nerede kopyalatmak istiyorsanız oraya copyDirectory(kaynak klasör,hedef klasör); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.