This seems pretty simple and maybe I'm just overlooking the proper flag, but how would I, in one command, copy a file from one directory to another and rename it in the destination directory? Here's my command:
if exist "bin\development\whee.config.example"
if not exist "TestConnectionExternal\bin\Debug\whee.config"
xcopy "bin\development\whee.config.example"
"TestConnectionExternal\bin\Debug\whee.config"
It prompts me with the following every time:
Does TestConnectionExternal\bin\Debug\whee.config specify a file name or directory name on the target (F = file, D = directory)?
I want to suppress this prompt; the answer is always F
.
XCOPY with * at the end of the target to copy files whether they exist or not in destination XCOPY with \ at the end of the target to copy folders and contents whether exist or not in destination
Alternatively
RoboForm SOURCE DEST FILE for files RoboForm SOURCE DEST for folders
The right thing to do if you wanna copy just file and change it's name at destination is :
And it's Gonna work fine
I suggest
robocopy
instead ofcopy
orxcopy
. Used as command or in GUI on clients or servers. Tolerant of network pauses and you can choose to ignore file attributes when copying of copy by file attributes. Oh, and it supports multi-core machines so files are copied much faster in "parallel" with each other instead of sequentially.robocopy
can be found on MS TechNet.For duplicating large files, xopy with /J switch is a good choice. In this case, simply pipe an F for file or a D for directory. Also, you can save jobs in an array for future references. For example:
Thanks to Chand with a bit modifications: https://stackoverflow.com/users/3705330/chand
Don't use the
xcopy
, usecopy
instead, it doesn't have this issue.xcopy
is generally used when performing recursive copies of multiple files/folders, or when you need the verification/prompting features it offers. For single file copies, thecopy
command works just fine.Just go to http://technet.microsoft.com/en-us/library/bb491035.aspx
Here's what the MAIN ISSUE is "... If Destination does not contain an existing directory and does not end with a backslash (), the following message appears: ...
Does destination specify a file name or directory name on the target (F = file, D = directory)?
You can suppress this message by using the /i command-line option, which causes xcopy to assume that the destination is a directory if the source is more than one file or a directory.
Took me a while, but all it takes is RTFM.