Hi, I've been working on this mini project on a WFA. Basically what I'm trying to do is, move files through a checkedListBox. I have the c.listbox and i got the items on it, but I want to have the files moved (only the checked ones) into a pre-defined directory and opened on the click of a button. I've tried an assortment of methods of doing this, but I just can't seem to get the path of the items that have been 'checked'.
I've used the FileInfo class to get the files into the checkedlistbox, because I'm looking only for the .vpk files:
private void button1_Click(object sender, EventArgs e)
{
DirectoryInfo di = new DirectoryInfo(dDir);
FileInfo[] vpkFiles = di.GetFiles("*.vpk");
foreach (FileInfo fi in vpkFiles)
{
checkedListBox1.Items.Add(fi.Name);
}
}
I've tried a bunch of things to get the path of the items, but this is where I left off, I tried doing the same for this part, and I even tried using Path.GetDirectories of the item, but it only seems to bring me to the path of the 'Bin' folder:
foreach (object itemChecked in checkedListBox1.CheckedItems)
{
string P = Path.GetFullPath(itemChecked.ToString());
DirectoryInfo di = new DirectoryInfo(P);
FileInfo[] maps = di.MoveTo(dDir);
}