Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 08-05-2011, 06:16 PM   #1
Beta Member
 
Join Date: Jun 2011
Posts: 5
Default Batch Copy with .bat File

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?
__________________

person287 is offline   Reply With Quote
Old 08-06-2011, 09:54 AM   #2
Fully Optimized
 
BikerEcho's Avatar
 
Join Date: Feb 2011
Location: Denmark
Posts: 4,013
Default Re: Batch Copy with .bat File

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
__________________

__________________
MOBO: Asus Maximus 6 Hero - GPU: Gigabyte GTX 980ti xtreme - CPU: I7-4770K - PSU: Corsair AX760
RAM: Corsair Vantage 2x4GB - SSD: Samsung 840 EVO 512 + LiteOn LCS-256 - Case: NZXT H440
BikerEcho is offline   Reply With Quote
Old 08-06-2011, 10:52 AM   #3
Beta Member
 
Join Date: Jun 2011
Posts: 5
Default Re: Batch Copy with .bat File

Thanks. I'll try that.
person287 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 02:16 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0