What I have is a listbox being populated by a textbox.
I want to search in a specific directory for all files that match the listbox criteria. I want do do this for each listing in the listbox, then I want to copy out all the matching files to another directory.
So Listbox contains: Apple Orange Fruit
i want to copy apple*.txt to destiondirectory, then copy orange*.txt to destination directory, and fruit*.txt to destinationdirectory.
After everything has been copied i want to create a text file of each thing being copied to it's own text file. So a directory listing from the destinationdirectory.
So i would just get a text file of all the files that match a specific criteria IE apple*
Thanks for the help and advice.
string[] filesToCopy = listBox1.Items.
string sourcefolder1 = @"K:\rkups";
string destinationfolder = @"K:\g_aa_ge\qc";
{
string source = Path.Combine(sourcefolder1, filesToCopy[] + ".ann");
string target = Path.Combine(destinationfolder, filesToCopy[] + ".ann");
File.Copy(source,target);
DirectoryInfo di = new DirectoryInfo(destinationfolder);
FileInfo[] annfiles = di.GetFiles(string+"*.txt);
foreach(FileInfo fi in annfiles)
the string+ is where i dont understand where/how to list each item in the listbox, and where string[] filesToCopy = listBox1.Items. not sure how to list each item in the string
updated:
1) read each item in listbox
2) try to copy from a sourcedirectory to a destinationdirecory the item in listbox
3) repeat
thats it