Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF:FolderBrowser dialog select multiple folders &or Files/Multiple Files (C#)

$
0
0

Hi Guys good morning!

I'm using `FolderBrowseDiloag` to open a folder to get images by filter & it works.

I want to propose the user to `Select Multiple Folders or File/Files(selected type : ".jpg", ".gif", ".png", ".tiff")`

Is there any way to to do this?

How can i select Multiple folders?

How can i select files or files by filter?    

Please help me & thank you very much.

This is the button function :

private void b4x6Files_Click(object sender, RoutedEventArgs e)
        {
			FolderBrowserDialog fbd = new FolderBrowserDialog();
            DialogResult result = fbd.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                string destination_dir = System.IO.Directory.GetCurrentDirectory() + @"./4x6";

                string[] extensions = { ".jpg", ".gif", ".png", ".tiff" };

                string[] dizin = Directory.GetFiles(fbd.SelectedPath, "*.*")
                    .Where(f => extensions.Contains(new FileInfo(f).Extension.ToLower())).ToArray();

                t4x6Folder.Text = dizin.Count().ToString();

                foreach (string file_name in dizin)
                {
                    File.Copy(file_name, destination_dir + file_name.Substring(fbd.SelectedPath.Length), true);
                }
                //int fileCount = Directory.GetFiles(destination_dir, "*.*", SearchOption.TopDirectoryOnly).Length;

                //t4x6Folder.Text = filepreCount.ToString();// fileCount.ToString();

            }
	}



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>