c# - Copy all contents of a directory and change names of the existing contents -
There is a start here I am trying to copy all the contents from one folder to another, suppose the initial folder is called inputDir , and the file I copy is called outputDir thing is, some files already in outputdir , And all of them have been named like files in inputDir . This looks like this: What I am trying to do is to designate all the files inside outputDir so that all the characters are 'bak' at the end of their 'name' And then copy all the files from inputDir to outputDir before their extension. In short, I want to look it like this: So far, I've tried to do this separately for each file, and it works fine; However, to write a lot of code, 20 more files are monotonous, so I'd love to know that there is a fast way to do this in C # (yes, I need it in C #, I wrote in the program More than that, but I've already covered everything). Thank you in advance for any help. This is what I have tried so far: - inputDir * hit0.png * hit100.png * hit300.png - outputDir * hit0.png * hit100.png * hit300.png
- inputDir * hit0.png * hit100.png * hit300.png - outputDir * hit0.png * hit0bak.png * hit100.png * Hit00bak.png * hit300.png * hit300bak.png
if (file.Exists (outputDir + "\\" + "hit0 PNG")) (file.main Output DIR + "\\" + "Hit -0.png", Output DIR + "\\" + "Hit-02.Connect"); File Next (Output DIR + "\\" + "Hit 100.png "Output dir +" \\ "+" hit 100 bak.png "); file. Forward (outputdir +" \\ "+" hit 300.png ", outputdear +" \\ "+" hit 300bak.png "); } File Copy (Input + + "\\" + "hit0.png", outputDir + "\\" + "hit0.png"); File Copy (InputDir + "\\" + "Hit 100.png" , Output DIR + "\" "+" hit100.png "); File Copy (InputIir +" \\ "+" Hit 300.png ", output dir +" \\ "+" hit 100.png ");
Comments
Post a Comment