Use
File.Copy(filePath, newPath, true);
The third parameter is overwrite, so if you set it to true the destination file will be overwritten.
More Related Contents:
- Double to string conversion without scientific notation
- How costly is .NET reflection?
- Best way to compare two complex objects
- What exactly is an “open generic type” in .NET? [duplicate]
- What are attributes in .NET?
- How to read a large (1 GB) txt file in .NET?
- Requested registry access is not allowed
- .NET Memory issues loading ~40 images, memory not reclaimed, potentially due to LOH fragmentation
- Immutability of structs [duplicate]
- Getting / setting file owner in C#
- What’s the best way of accessing field in the enclosing class from the nested class?
- Printing to a client printer from a web app
- .NET : How do you get the Type of a null object?
- How to check if IOException is Not-Enough-Disk-Space-Exception type?
- Why does the async keyword exist
- Difference between IEnumerable Count() and Length
- “new” keyword in property declaration in c#
- Why is infinity printed as “8” in the Windows 10 console?
- Binding an enum to a WinForms combo box, and then setting it
- Convert Transparent PNG to JPG with Non-Black Background Color
- Why does my .NET application crash when run from a network drive?
- Best way to update LINQ to SQL classes after database schema change
- Anonymous Type vs Dynamic Type
- itextsharp – CSS not getting applied – C# .NET
- Can’t await async extension method
- Can you make an alpha transparent PNG with C#?
- Await and SynchronizationContext in a managed component hosted by an unmanaged app
- Using .net standard 1.5 lib in .net 4.6.2 misses System.Runtime 4.1.0.0
- Map two lists into a dictionary in C#
- Why remove unused using directives in C#?