1.

Solve : Overwriting?

Answer»

Ok, I have a batch file that converts all of a certain file type in one folder to a different filetype in a seperate folder.

My problem is that every time I use my batch file, the files in the second folder don't get overwritten, so I have a copy of most files. So, is there anyway to overwrite them?Check the help on Copy :
Copy /?
Copies one or more files to another location.

COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B]
[+ source [/A | /B] [+ ...]] [destination [/A | /B]]

source Specifies the file or files to be copied.
/A INDICATES an ASCII text file.
/B Indicates a binary file.
/D Allow the destination file to be created decrypted
destination Specifies the directory and/or filename for the new file(s).
/V Verifies that new files are written correctly.
/N USES short filename, if available, when copying a file with a
non-8dot3 name.
/Y SUPPRESSES prompting to confirm you want to overwrite an
EXISTING destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line. DEFAULT is
to prompt on overwrites unless COPY command is being executed from
within a batch script.

To append files, specify a single file for destination, but multiple files
for source (using wildcards or file1+file2+file3 format).

You will see the /Y parameter tells copy to always overwrite

GrahamI've already added /y to my copy code; I just figured out that my problem was that I change every file in the second folder to .gif (whereas they start as .bmp), so they don't get overwritten.

Anyway, thanks for your help.



Discussion

No Comment Found