# Copying a file from one folder, renaming and replacing to another folder



## hammyd (Jan 11, 2014)

Here is my problem. I have one folder with a png file named redirect.png. I have a second folder with several files (File1.png, file2.png, file3.png) that have different images, hence the different file names. Is there a way to copy the redirect.png file, and rename it to file1, file2, file3.png so that when file1, file2 and file3 are opened, they have the same image/content as the redirect.png file?


----------



## TonyB25 (Jan 1, 1970)

Delete File1.png, File2png, and File3png and create shortcuts with the same names pointing to the file redirect.png.


----------



## hammyd (Jan 11, 2014)

TonyB25 said:


> Delete File1.png, File2png, and File3png and create shortcuts with the same names pointing to the file redirect.png.


 I forgot to mention, the new files (file1, file2, file3) will be uploaded to another program, therefore creating shortcuts does not work for me. Let me elaborate further. Filenames file1, file2, file3 are set file names in a folder. I would like an automated process that picks the name of file1, file2, file3, and creates copies of redirect.png named file1.png, file2.png, file3.png. Is that even possible?


----------



## foxidrive (Oct 20, 2012)

If you run this batch file in the folder with the files, then the redirect.png should be copied over the existing files.


```
@echo off
for %%a in (*.png) do copy "c:\folder\redirect.png" "%%a"
```


----------

