Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a structure of folders, each containing a file with the same name "Client - Document.docx". Is there a utility or expedient method (running Windows XP) to replace each of these files with an updated version of the file beyond 120 CTRL+C,Vs?

For raw commands, please explain what the syntax is, and the switches used.

share|improve this question
up vote 1 down vote accepted
  • Assuming the existing files are called doc1.doc, and
  • assuming the new file is called doc1.doc and is in the current directory, and
  • assuming the file tree starts in Dir1

    for /r Dir1 %a in (doc1.doc) do copy /y doc1.doc %~pa\doc1.doc
    You will need quotes around any file names with spaces.

For /r Dir1 in (doc1.doc) tells "for" to search subdirectories of Dir1 for doc1.doc and put each file found in the %a variable.

copy /y says replace without asking

%~pa1 is the path only component of the %a variable.

Run this for a non-destructive look at what might happen

for /r Dir1 %a in (doc1.doc) do echo %~pa\doc1.doc

share|improve this answer
Do you mind explaining what the syntax is, and the switches used? – mfg Mar 15 '12 at 15:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.