Here's what worked for me to copy and overwrite a file from B:\ to Z:\ drive in a batch script. The "/Y" parameter at the end overwrites the destination file, if it exists. Show activity on this post. You can refer Windows command prompt help using following command : xcopy /?
Overwriting a File, Part 1 To edit the settings for a file, locate the file you wish to overwrite and hover over the file name. Click the chevron button that appears to the right of the file name and select Overwrite File from the menu.
As the operator (the person running a container from the image), you can override that CMD just by specifying a new COMMAND. If the image also specifies an ENTRYPOINT then the CMD or COMMAND get appended as arguments to the ENTRYPOINT. So to do what you want you need only specify a cmd, and override using /bin/bash .
Copies source files changed on or after the specified date only. If you do not include a MM-DD-YYYY value, xcopy copies all Source files that are newer than existing Destination files. This command-line option allows you to update files that have changed.
Add /Y to the command line
You can use :
copy /b/v/y
See SS64 on COPY.
Add /y
to the command line of xcopy
:
Example:
xcopy /y c:\mmyinbox\test.doc C:\myoutbox
you need to simply add /Y
xcopy /s c:\mmyinbox\test.doc C:\myoutbox /Y
and if you're using path with spaces, try this
xcopy /s "c:\mmyinbox\test.doc" "C:\myoutbox" /Y
If the copy command is run from within a batch job you do not need to use the /Y switch: it will overwrite existing files.
For copying one file to another directory overwriting without any prompt i ended up using the simply COPY command:
copy /Y ".\mySourceFile.txt" "..\target\myDestinationFile.txt"
A command that would copy in any case
xcopy "path\source" "path\destination" /s/h/e/k/f/c/y
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With