Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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.

FYI -
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
add comment

Your Answer

 
discard

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.