February 22, 2005 at 9:57 pm
Hai gurus,
I am unable to copy using xcopy
exec master.dbo.xp_cmdshell N'xcopy D:\testing\testbat.bat D:\testing\DTS\testbat.bat < NUL:'
exec master.dbo.xp_cmdshell N'xcopy D:\testing\testbat.bat D:\testing\DTS\testbat.bat'
I get the following output
Does D:\t8001.txt specify a file name
or directory name on the target
(F = file, D = directory)? ?
Does D:\t8001.txt specify a file name
or directory name on the target
(F = file, D = directory)?
Any ideas how to solve this. But this works in DOS promt with the query like
Does D:\t8001.txt specify a file name
or directory name on the target
(F = file, D = directory)? ?
Does D:\t8001.txt specify a file name
or directory name on the target
(F = file, D = directory)?
If I give f it copies the file
Thanks in advance
Helen
--------------------------------
Are you a born again. He is Jehova Jirah unto me
February 22, 2005 at 10:33 pm
Just specify the destination directory without the filename.
EG: exec master.dbo.xp_cmdshell N'xcopy D:\testing\testbat.bat D:\testing\DTS'
--------------------
Colt 45 - the original point and click interface
February 22, 2005 at 11:28 pm
Hai Phill,
That worked great
Thanks a lot
Helen
--------------------------------
Are you a born again. He is Jehova Jirah unto me
February 23, 2005 at 1:53 am
It is worth looking at the help text for XCOPY because there are a number of switches that are extremely useful.
I have to copy across a backup file from one server to another every night and use three switches
/q Suppresses all XCOPY status messages (but not prompts)
/d Only bothers to copy the file if the timestamps are different. The file is very large so this is extremely useful.
/y Answers 'Y' to any prompts asking "Do you want to copy the file?"
There are a load more besides that allow copying of sub-directories, whether those directories should be copied if their empty etc.
April 21, 2010 at 9:26 am
echo f| xcopy sourcefilename destination filename -- will also work to return the prompt for filename or directory.
April 21, 2010 at 10:39 am
Just an FYI, starting with Windows Server 2008 XCOPY has been flagged from depreciation. Recommended replacement is ROBOCOPY.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply