Hi there, I'm having a problem that's probably pretty easy to fix.
I am trying to get information from a directoryInfoBox, post that as working directory, then create a directory from a textBox and move all the files into it.
The thing is, it will only create the directory, I don't think it's reading any files at all,
Here's the code, if you need more of it I'll post more:
Code:
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
//To String Button
//---------
//Goal:
//Create Dir: Dialog Selected\TextBox1 Text
//Then,
//Move: Files_In_Enumerator To Dialog Selected\TextBox1 Text
//---------
//Path: Selected Path
//Path2: Selected Path\TextBox1 Text
//Di: Create Directory: "Path2"
//Movepath: Dialog Selected\TextBox1 Text\
//---------
System::String* path1 = folderBrowserDialog1->SelectedPath;
System::String* path2 = String::Concat(path1, S"\\", textBox1->Text);
DirectoryInfo* di = Directory::CreateDirectory(path2);
DirectoryInfo* dui = new DirectoryInfo (path2);
FileInfo* fi[] = dui->GetFiles();
Collections::IEnumerator* myEnum = fi->GetEnumerator();
int i=0;
while (myEnum->MoveNext())
{
FileInfo* fiTemp = __try_cast<FileInfo*>(myEnum->Current);
File::Move(myEnum->Current->ToString(), path2);
i++;
}
}
Any help is greatly appreciated!