Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating directories

Status
Not open for further replies.

dendog

Programmer
Jun 28, 2001
53
US
is there any stored procedure or extended stored procedure that can be used to creat a new directory on the machine that the sequal server is running on even if it is a remote machine.

Thank you very much in advance.

DENNIS
 
The stored procedure to use is xp_cmdshell, see BOL for more info.

Example
EXEC master..xp_cmdshell 'MD C:\TestDIR'

The above example creates a new directory in C: called TestDir


dbtech
 
If a login has permissions and xp_cmdshell is avaliable, you can us this extended stored proc to do what you want.

exec xp_cmdshell 'md e:\mssql\dba_scripts'

You should be able to use the OLE Automation procedures to create a File System Object and use the CreateFolder method to create the directory. Use sp_oacreate to create the object - FSO. Use FSO.CreateFolder to create the directory.

See OLE Automation in SQL BOL. Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top