Computing.Net > Forums > Programming > Replacing file in Dos

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Replacing file in Dos

Reply to Message Icon

Name: sudip_dg77
Date: November 5, 2008 at 17:44:21 Pacific
OS: Windows XP
CPU/Ram: not important
Product: not important
Comment:

Hi,
I work for a release management team for a company handling all the releases of files that are placed into production environment every week.
Now I am trying to write a dos batch file which would do the following:
Compare the names of the files that are going to be released with the existing files that are already on the server and then show me a report saying which are the files that are going to be replaced and ask for confirmation from me before the actual replacement of file happens.
Also this report showing which files are being replaced should be sent over to me via an e-mail.
Any help will be appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: November 6, 2008 at 03:16:24 Pacific
Reply:

First, NT/XP is not DOS, so it's one or the other.

I'm not clear on what's needed. Is the list of source files a subset of the files on the server?


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: sudip_dg77
Date: November 6, 2008 at 06:07:52 Pacific
Reply:

I am trying to write a batch file in DOS which will do the following:

Step 1: Copy some files(like for example a.txt, b.txt, c.txt) from a disk location C:/

Step 2: Put the above copied files to a disk location C:/Release/

Step 3: Before putting the files from the location C:/ to C:/Release/ it should make a note of files that are going to be replaced(if say for example a.txt, b.txt, c.txt already exists in the location C:/Release/)

Step 4: Ask for confirmation saying following are the files that are going to be replaced...do you want to continue?

Step 5: Send an e-mail to my mailbox with a report saying which all files were replaced.

Hope this clarifies...now can someone help


0

Response Number 3
Name: klint
Date: November 6, 2008 at 14:55:34 Pacific
Reply:

Here are some Windows XP batch file commands you can use. (Note that these won't work in DOS, but I am assuming you are not using DOS but Windows XP's cmd.exe.)

@echo off
setlocal
pushd C:\Release
dir a.txt b.txt c.txt
set p=N
set /p p=Do you want to overwrite the above files (Y/N)?
if /i %p% == y for %%f in (a.txt b.txt c.txt) do copy ..\%%f .
start mailto:user@example.com?subject=The%20files%20have%20been%20copied

If you want a better automatic emailing facility, you will have to download a command-line email utility. I hope the above helps to get you started.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Replacing file in Dos

display Tiff file in DOS/C/TSR www.computing.net/answers/programming/display-tiff-file-in-dosctsr/2195.html

Help needed renaming a file in DOS www.computing.net/answers/programming/help-needed-renaming-a-file-in-dos/12770.html

Read lines from .txt file in DOS? www.computing.net/answers/programming/read-lines-from-txt-file-in-dos/15219.html