February 18, 2005 at 12:39 pm
I know we can copy a file from one directory to another as the script below, but I wonder if there is a way to copy from a directory to an access restricted directory where requires an id and password to access it.
I really appreciate your help. Thanks!
USE masterEXEC xp_cmdshell 'copy c:\sqldumps\pubs.dmp \\server2\backups\sqldumps', NO_OUTPUT
February 18, 2005 at 1:09 pm
You would need either use an ID that has implicit rights to the directory.
The other possibility is run a "net use" command first.
Such as
USE masterEXEC xp_cmdshell 'NET USE \\server2\backups\sqldumps %PASSWORD% /USER:domainname\username /PERSISTENT:YES /SAVECRED'
The problem with this is it leaves the password in clear text.
----------------
Jim P.
A little bit of this and a little byte of that can cause bloatware.
February 18, 2005 at 2:36 pm
Thank you Jim for your help. However, I think I did not express correctly what I wanted to do. Actually, what I wanted to do was to copy one file from my personal folder to a client's ftp site (this ftp site requries a user name and password in order to access and I do have them).
Is there a way to do this?
Thanks!
February 18, 2005 at 3:44 pm
If you are trying to FTP that is a whole different animal. But it is conquerable.
This will need to be a several step process. First you will need to write out a script file. Just a simple text file. (I generally name them after the application with a .scp extension.)
[userid] [password] lcd c:\sqldumps prompt Turn off prompts binary set binary transfer mode cd \\server2\backups\sqldumps This is the remote dir put c:\sqldumps\pubs.dmp bye
It should look something like that. You'll need to play around with the command line FTP to get it right.
Next step is to do the actual FTP. It will be something like
FTP -s:C:\TEMP\application.SCP xxx.xxx.xxx.xxx
Hope this helps. BTW, can you edit your first post so it isn't so wide?
----------------
Jim P.
A little bit of this and a little byte of that can cause bloatware.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply