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 |
|
jessop
Starting Member
9 Posts |
Posted - 2002-07-02 : 11:14:56
|
| Apologies for souble-posting but more people are looking at thread here.Hi, can anyone help? I need to read local file information (specifically the filename) on a box running SQL 7. I don't want to use the FileSystemObject in the ActiveXScript of a DTS package. I am also keen to avoid using xp_cmdshell. It does seem that you can use linkedservers to get the information but why do this for a local server? I can't get it to work in any case. For example, I would like to return info on file on the C Drive in the tabular style of a linkedserver search using a SCOPE of C: Any ideas please??? |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-07-02 : 12:27:02
|
| master.dbo.xp_getfiledetails<O> |
 |
|
|
jessop
Starting Member
9 Posts |
Posted - 2002-07-02 : 12:58:07
|
| Thank-you so much....can I be cheeky and ask if you know how to use this to return this information for everything in a directory and perhaps even filter according to file type etc??Thanks againMark |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-07-02 : 13:19:41
|
| Can you use xp_cmdshell to do a dir?<O> |
 |
|
|
jessop
Starting Member
9 Posts |
Posted - 2002-07-02 : 13:25:25
|
| Hi,I can use xp_cmdshell but the results are quite 'dirty' and need formatting for use by an ASP page. Any ideas?CheersMark |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-07-02 : 13:28:25
|
| I don't know any tricks for this one (doesn't mean they don't exists) . . . I would create a temp table and insert #cmdshell exec master.dbo.xp_cmdshell('dir c:') and then mess with the temp table to get the formatting how you like....<O> |
 |
|
|
izaltsman
A custom title
1139 Posts |
Posted - 2002-07-02 : 13:34:47
|
quote: I can use xp_cmdshell but the results are quite 'dirty' and need formatting for use by an ASP page. Any ideas?
I am not sure what you mean by "dirty", but using dir with a "/b" parameter should let you get just the filenames...Try the following in Query analyzer: EXEC master..xp_cmdshell 'dir c: /b' |
 |
|
|
jessop
Starting Member
9 Posts |
Posted - 2002-07-02 : 13:39:35
|
| Terrific - thanks to both who have answered these questions!!!!! |
 |
|
|
|
|
|