Robocopy to copy a specific file from subdirectories

I need a DOS batch script please that will copy a specific file called TOC.html from:-

D:\Program Files\cognos\c8\webcontent\NBSDocs\ to \\csdwinapp01\d$\program files\cognos\c8\webcontent\NBSDocs\

Please note as stated there is a TOC.html which is located in the subdirectories in the NBSDocs folder and it is this file that needs copying.

Thanks for you help
rakkadAsked:
Who is Participating?
 
hari_b85Commented:
You can use the below command,

robocopy "D:\Program Files\cognos\c8\webcontent\NBSDocs" "\\csdwinapp01\d$\program files\cognos\c8\webcontent\NBSDocs" TOC.html /e /v /r:2 /w:2
0
 
knightEknightCommented:
It should by as simple as this:

copy/y  "D:\Program Files\cognos\c8\webcontent\NBSDocs\TOC.html"  "\\csdwinapp01\d$\program files\cognos\c8\webcontent\NBSDocs\"
0
 
SNeupaneCommented:
I don't see that folder NBSDocs in our environment.
But if the file exists, use this batch file. We use similar to copy report output to a shared location.

d:
cd cd "D:\Program Files\cognos\c10bi\webcontent\NBSDocs\"
if exist "TOC.html" copy /y  "TOC.html" "\\csdwinapp01\d$\program files\cognos\c8\webcontent\NBSDocs\"
exit


Sometimes, you have to share the folder directly instead of the drive d$ and allow write permissions so it can be copied..
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
SNeupaneCommented:
Update:
the last reply had 2 cd in the code.
Here is correct one:
d:
cd "D:\Program Files\cognos\c10bi\webcontent\NBSDocs\"
if exist "TOC.html" copy /y  "TOC.html" "\\csdwinapp01\d$\program files\cognos\c8\webcontent\NBSDocs\"
exit
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 
SNeupaneCommented:
Shouldn't my posts get some credit?
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
No, because the asker is talking about TOC.html being located in subfolders. http:#a35813727 is the only post considering that.

Qlemo
Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.