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.
Author |
Topic |
jlgervais
Starting Member
3 Posts |
Posted - 2010-07-06 : 12:02:55
|
can't figure this one out, i want to retrieve file names from a particular directoryCREATE PROCEDURE [dbo].[sp_GetFilesInDirectory]ASBEGINDECLARE @CMD VARCHAR(5000)DECLARE @Error INTDECLARE @DirResult TABLE (i INT IDENTITY(1,1) NOT NULL, strData VARCHAR(7000))--THIS WORKS !SET @CMD = 'DIR E:\IMPORT'--Here's the problem, if i set my command to :SET @CMD = 'DIR E:\IMPORT\TEST'problem is, as soon as i ask for a subdirectory, i get a "File Not found, there are files in that directory, that command returns two files in a command line windowINSERT INTO @DirResult EXEC @Error = master..xp_cmdshell @CMDSELECT * FROM @DirResultEND-- i cannot change the directory, it has to be a subdirectorythanks |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-06 : 12:26:17
|
Sorry but I can't see the DIR-command and with only the path it will not work... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
jlgervais
Starting Member
3 Posts |
Posted - 2010-07-06 : 12:36:44
|
quote: Originally posted by webfred Sorry but I can't see the DIR-command and with only the path it will not work... No, you're never too old to Yak'n'Roll if you're too young to die.
small mistake while editing my poststill doesn't work, even with the DIR command |
 |
|
|
|
|