Tuesday, September 08, 2009

Copying files across parallel directory structures.

It happens to all of us, you've made a change in branch2, now you need to copy it to branch1. Here's a trick I use to accomplish this task:
C:\src\branch1\mydir\mydir2\mydir3\mydir4>xcopy %cd:branch1=branch2%\foo*
Overwrite C:\src\branch1\mydir\mydir2\mydir3\mydir4\foo.txt (Yes/No/All)? y
1 File(s) copied
How'd that work? Use echo to find out what happened:
C:\src\branch1\mydir\mydir2\mydir3\mydir4>echo %cd:branch1=branch2%
For more information run help set.

No comments: