Batch Copy with .bat File

person287

Beta member
Messages
5
Not sure this is the right section but anyway. I've designed an application which requires database details, and these details have to be input in every folder (it's a php file by the way so you can't see it via the web). The file is called dbinfo.inc.php, and I want to Copy it to ../Monday1/, ../Monday2/, etc. So basically if the file is in;

C:/Users/Joe Blogs/My App/dbinfo.inc.php
it'd be copied to
C:/Users/Joe Blogs/My App/Monday1/dbinfo.inc.php

How could I do this. Am I right in thinking that a .bat file would be best?
 

BikerEcho

Fully Optimized
Messages
4,029
Location
Denmark
batch will be perfect able to do this job. i use my own backup batch file to backup all my important data.
try this
xcopy C:\Users\"Joe Blogs"\"My App"\dbinfo.inc.php C:/Users/Joe Blogs/My App/Monday1 /c /s /r /d /y /i /h /f

the "" is if a path has a space like joe blogs. it needs to know that this folder is 2 words
the /c and all other of the /something is parameters. thay make some rules for the copy.
with these parameters the xcopy command will replace any old copy of the dbinfo.inc.php and also if the folder does not exist it will be ceated. it will also tjek if the file that is being copyed is identical to the file allready in the distination folder.
if it is identical it will not borther copying the file. just google batch parameters and you will find a list of all the rules you can give the copy.

hope it helps
 
Top