| 17 |
| Replace files with the REPLACE command in Windows 2000 |
| The time may arise when you need to replace a file with a different version. For example, maybe |
| you're replacing an HTML file with an updated version. If you're only dealing with a few files, it's |
| generally easiest to use the COPY command to replace the file, or publish/save the file from the |
| application you use to create it. |
| The COPY command isn't the best solution when you're replacing the same file in several |
| locations or needing to replace Read-only files. Instead, use the REPLACE console command, which |
| lets you replace one or more instances of a file with a single operation. Say you need to replace a |
| particular file that exists in several subdirectories under a particular folder; you can use REPLACE |
| to replace all of them with one command. |
| Here's an example of the REPLACE command being used to replace the file Something.txt in all |
| subdirectories of the current directory: |
| REPLACE C:\source\Something.txt C:\destination\Something.txt /S |
| The /S switch accomplishes the recursive replacement. You can also use a handful of other switches |
| with REPLACE to accomplish similar tasks. For example, you can use the /A switch to add new files |
| to the destination directory or /U to update files that are older than the source files. To use the |
| REPLACE syntax and its switches, open a console and enter REPLACE /?. |
First Previous Next Last |