Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 xp_cmdshell

Author  Topic 

Angela
Starting Member

11 Posts

Posted - 2005-04-08 : 12:12:29
Is there a way to use xp_cmdshell to get a filename...just the filename and no other information? If not I have a sp and I need to import records into sql from a text file which i can do no problem but then i need to get the file name of the text file..any ideas?

rfrancisco
Yak Posting Veteran

95 Posts

Posted - 2005-04-08 : 12:17:19
Try this:

EXECUTE master.dbo.xp_cmdshell 'dir /b "C:\Temp\*"'
Go to Top of Page

Angela
Starting Member

11 Posts

Posted - 2005-04-08 : 12:27:55
YOU ARE THE BEST..where can i find a list of the switches?
Go to Top of Page

rfrancisco
Yak Posting Veteran

95 Posts

Posted - 2005-04-08 : 12:47:28
Go to DOS and issue dir/?
Go to Top of Page
   

- Advertisement -