C#
C#

help

Root Question Message

Cametolose
Cametolose1/25/2023
❔ Replace many files automatically

Hey, I want to replace hundreds or thousands of files with the same name. The files are saved in different directories. I already got it kinda working, but it don't replace files that are in different directories with the same name. Here is what I already have:
string SourcePath = "Path1";
string DestinationPath = "Path2";
foreach (string path in Directory.GetFiles(SourcePath, "*.*", SearchOption.AllDirectories))
    File.Copy(path, path.Replace(SourcePath, DestinationPath), true); 
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy