January 30, 2010 at 10:02 am
I am using to copy files from 1 folder to another. I get the result as copied but actually they are not copied, i dont see any files in the destination folder.
EXEC master..xp_cmdshell 'COPY \\OBBEVAER\IT_Reports\Database_Reports\*.mhtml
\\OBBEVAER\IT_Reports\DBA\'
Result:
\\OBBEVAER\IT_Reports\Database_Reports\Oct_Revenue_Report.mhtml
\\OBBEVAER\IT_Reports\Database_Reports\Oct_Memebers_Report.mhtml
2 file(s) copied.
NULL
Actually i want to copy all .mhtml files to destination folder and want to rename the existing file with date stamp. any help ?
January 30, 2010 at 10:35 am
Sounds silly but did you hit "refresh" when you looked in the destination folder?
--Jeff Moden
Change is inevitable... Change for the better is not.
January 30, 2010 at 11:22 am
ohh yeah, there is no file in there? any other way to do ?
January 30, 2010 at 11:28 am
Without any errors, the files should be copied. Maybe a rights problem? What do you get if you execute the following statement:
EXEC master..xp_cmdshell 'DIR \\OBBEVAER\IT_Reports\DBA\'
January 30, 2010 at 11:42 am
i get this..
Volume in drive \\OBBEVAER\IT_Reports is OBBEVAER_Data
Volume Serial Number is B2BD-B330
NULL
Directory of \\OBBEVAER\IT_Reports\DBANULL
File Not Found
NULL
January 30, 2010 at 12:52 pm
Are there currently files in the destination folder that should have displayed with "DIR" ? Or is the folder empty ? If the folder is empty, put a test file in there for testing purposes.
January 31, 2010 at 5:22 pm
Tara-1044200 (1/30/2010)
i get this..Volume in drive \\OBBEVAER\IT_Reports is OBBEVAER_Data
Volume Serial Number is B2BD-B330
NULL
Directory of \\OBBEVAER\IT_Reports\DBANULL
File Not Found
NULL
That means that the login that the SQL Service is starting with cannot see that path/directory. SQL Server probably needs to boot up using a domain user.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 1, 2010 at 9:34 am
I agree that it could be a permission issue and you just don't see any errors. When I have issues such as this with copying filee using xp_cmdshell, I try logging on to the server in SSMS using the service account or whatever account is running the command that fails to copy and try running it. Usually I'll see an error message.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply