1.

Solve : DOS command which prompt overwrite?

Answer»

Does anoyne KNOW any DOS command which prompt overwrite?

I created a BAT file for a program called FSUM (It is a program for checksum).

In my BAT file, it contains:
fsum -md5 -r *.* >md5_checksum.txt

The above command will copy the output to a txt file. However if there's an existing file with the same name already, it will overwrite it without prompt.

What I would like to do is, eg:
When I wish to copy the result to a file (eg aaa.txt), if aaa.txt EXISTS already, it will show something like:
- there's the same file exists here. Are you sure you want to overwrite it. If so, type "Y". if not, type "N"?

How to force the DOS command to prompt before it deletes or overwrite something?
Does anyone know any command which can do so?Well, not really prompting. But why DONT you use time stamping?If not exist md5_checksum.txt goto process
del md5_checksum.txt
:process
fsum -md5 -r *.* >md5_checksum.txt
Hi.
What's the use of adding:
- del md5_checksum.txt
- :process

When we execute "del md5_checksum.txt", it simply delete the file without prompt.

What I would like to do is:
When I wish to copy the result to a file (eg aaa.txt), if aaa.txt exists already, it will show something like:
- there's the same file exists here. Are you sure you want to overwrite it. If so, type "Y". if not, type "N"?

How to force the DOS command to rpompt before it deletes or overwrite something?Quote

Well, not really prompting. But why dont you use time stamping?


Hi, I'm just a beginner about DOS command.
What's "time stamping"?
How to use "time stamping"?


What I would like to do is:
When I wish to copy the result to a file (eg aaa.txt), if aaa.txt exists already, it will show something like:
- there's the same file exists here. Are you sure you want to overwrite it. If so, type "Y". if not, type "N"?

How to force the DOS command to prompt before it deletes or overwrite something?"
Quote
Hi.
What's the use of adding:
- del md5_checksum.txt
- :process

When we execute "del md5_checksum.txt", it simply delete the file without prompt.

What I would like to do is:
When I wish to copy the result to a file (eg aaa.txt), if aaa.txt exists already, it will show something like:
- there's the same file exists here. Are you sure you want to overwrite it. If so, type "Y". if not, type "N"?

How to force the DOS command to rpompt before it deletes or overwrite something?

The use of the IF was to avoid the error message, most of us like the batch files to proceed without displaying error MESSAGES.
If not exist md5_checksum.txt goto process
echo md5_checksum.txt will be overwritten. Press Ctrl+C to abort
pause
:process
fsum -md5 -r *.* >md5_checksum.txt

When the message is DISPLAYED, you can press ctrl+c to terminate the batch file. Any other key press will overwrite the existing file. If the message does not display, the file will be created. If using win9x you can use Choice to create a custom menu to select what you want to do.> = overwrite
>> = add


Discussion

No Comment Found