rename file

Winston TheFifth 101 Reputation points
2022-02-14T17:37:36.943+00:00

When I rename a file it drops the extension and I can't open it programmatically. How do you keep the extension? When I set a break point it includes the extension by checking in the immediate window. It's not included in the file name in the directory and I get an error Cannot open datafile.

string oldFile = "C:\New folder\";
string newFile = "C:\Sales\";
foreach(file f in Files)
{
System.IO.File.Move(oldFile + f.Name, newFile + f.Name + "New");
}

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,453 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,248 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful