Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

basic (?) file copying question

Status
Not open for further replies.

DoraC

Programmer
May 7, 2002
98
0
0
US
Hi,

I need to copy one group of files to a different directory, and was hoping to do this with something like "File.Copy". However - this does not seem to be meant to be... I've tried things like

File.Copy("C:\\dir1\\*.txt","C:\\dir2\\");

to no avail.. So - my question is, how in C# can I mass-copy one group of files identified (partially) by a meta-character into a different directory? This *seems* as though it would be a basic operation, but apparently not?

Thanks!
dora
 
You can only move or copy one file at a time with this object.method. You could create an array of file name and loop through it passing the string to a FileInfo object.

The Common Dialog classes also have a FileNames property that allow the user to select a number of files.

File class is static class. If you need instance information then FileInfo also works create.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top