I'm looking for a way to replace several files in a folder with the contents of a single external file, while retaining each file's original name. For example, I have a folder with files like test1.txt, test2.txt, etc. (let's say I have about 800 files), and I want to replace each of them with a different file called external.txt. I want the end result to be that test1.txt, test2.txt, etc. will all simply contain the new data from external.txt, but keep their original names. Is there a solution for this without having to manually copy and rename each file?
3 Answers
You can use PowerShell to achieve this! Just run a script like the one below, replacing the placeholders with your actual file paths:
```powershell
Get-ChildItem "{destination fullpath}" -Filter *.txt | ForEach-Object {
Copy-Item "{source full path}" -Force -Destination $_.FullName
}
```
This will copy the contents of your external file to each file in the specified folder. Just be sure to replace `*.txt` if you're dealing with different file types. It should work like a charm!
Just a heads up, I tried using PowerToys for this, but I wasn't sure if it did exactly what I needed or if I was using it wrong. So if you go that route, double-check the features!
Could you specify if you're on a Mac or a PC? It might change the solution a bit. If you're on a PC, definitely try the PowerShell method mentioned. If you’re on a Mac, let me know, and I can suggest something else!

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically