Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi I am simply trying to copy one file to replace and overwride it via a batch file, esentally trying to wipe clean my database csv file with a blank newley formated file, I can do this via a shortcut to a zip file to reset it but I want a single click solution.
source:
D:\My Documents\My Data Sources\reset\data.csvdestination:
D:\My Documents\My Data Sources\data.csvsorry I realyze this is a really simple task, but I no almost nothing about batch files so if you can tell me what code I need for this I would really appeiciate it, the original file of course would need to remain so I can run this again and again. thanks

Your post is confusing. You say "copy one file to replace and overwride it via a batch file, esentally trying to wipe clean my database csv file with a blank newley formated file". Then you say "the original file of course would need to remain."
So which is it? Do you want to replace the file or keep the original?
Soylent Green is PEOPLE!!!

Here you go mate: The first script will replace the original file with the blank one, WITHOUT asking you to confirm overwrite, and WITHOUT backing up the old file.
The second script will ask you to press any key before continuing, and will back up the original file before replacing it with the blank. The backup copy will be named data.csv_old.
1st Script:
--------------
@echo off
cls
D:
cd\my documents\my data sources
copy data.csv data.csv_old
copy .\reset\data.csv data.csv /Y2nd Script:
--------------
@echo off
cls
echo This will replace D:\My Documents\My Data Sources\data.csv with D:\My Documents\My Data Sources\reset\data.csv.
echo Press any key to continue, or press CTRL+C to terminate the batch job.
pause > nul
D:
cd\my documents\my data sources
copy data.csv data.csv_old
copy .\reset\data.csv data.csv /Y
echo The procedure is complete. Please check data file.
pause > nul
Copy and paste either script into notepad, and save as a batch file (.bat) by enclosing the filename in quotes, e.g. "replace.bat".Reply if this helped :)
Impavidus

sorry for the confusion in my post, and thanks Impavidus works great and did just what I need, you guys are awsome.

![]() |
Media Player headaches
|
Long hangup after selecti...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |