[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 658
  • Last Modified:

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
0
rakkad
Asked:
rakkad
1 Solution
 
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
 
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
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
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
 
QlemoC++ DeveloperCommented:
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
 
QlemoC++ DeveloperCommented:
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

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now