Dos XCOPY QUESTION

When I run xcopy W:\TEST.mdb W:\UpdateFolder\Dev2.mdb


I get the prompt...Does w:\UpdateFolder\Dev2.mdb specifiy a file name or directory name on the target
(F = File, D = Directory)

I want to run this from a batch file and cannot remember how to supply the F from the command line.
LVL 1
estackpoAsked:
Who is Participating?
 
Shift-3Connect With a Mentor Commented:
Prepend echo F|


echo F|xcopy W:\TEST.mdb W:\UpdateFolder\Dev2.mdb

Open in new window

0
 
Lee W, MVPConnect With a Mentor Technology and Business Process AdvisorCommented:
If you want to put it in a batch file, then create the W:\UpdateFolder in advance.  The /I switch will assume your target is a directory... so if you want to use XCOPY alone, then drop the file name in the destination.

Or use copy with the /Q switch.
0
 
QlemoConnect With a Mentor Batchelor, Developer and EE Topic AdvisorCommented:
or use copy instead (copy /b W:\TEST.mdb W:\UpdateFolder\Dev2.mdb)
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
estackpoAuthor Commented:
Shift - 3 :

 I am actually trying to do this from within an Access database using the Shell() command and while your solution works from the command line, it does not work from the Shell command.  Not sure why.


Leew:

  Only problem with that is the file is not a directory, but is a file. Also I want to change the name of the file after it is copied.

Olemo:
 
  As in my comment to Shift-3 Copy does not work with the Shell command for some reason.

I might just use the xcopy and then rename the file. If so, I will split the points between the 3 of you.
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Then use copy - there should be no problem.  If there is - post a screen shot so we can see what's going on.
0
 
estackpoAuthor Commented:
Copy is not recognized in the shell command.

I have a workaround...I will copy the file with the same name then rename it when it gets there.


Thanks for all your input. I will split the points
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
That doesn't make any sense.  Copy is BUILT IN to cmd.exe and command.com.  A screen shot (seeing is believing) would be helpful.  I use it frequently.
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Copy is build-in, that much is true. For System() call you need an executable. So you have to use
cmd /c copy ...
instead.
0
 
estackpoAuthor Commented:
I have a workaround for this issue. I just copy the files then rename them. I will split the points.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.