Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««1234»»»

Pulling Filename from Windows directory into table Expand / Collapse
Author
Message
Posted Wednesday, July 22, 2009 10:19 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 9:58 AM
Points: 36,995, Visits: 31,517
tjm (7/22/2009)
Nope. Worked Great! Thanks for all your help!

Implemented and is already on production server.

-tjm


Wow... you folks don't waste any time. Thanks for the feedback.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #757639
Posted Friday, July 31, 2009 10:09 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 5:26 PM
Points: 219, Visits: 1,156
Having a brain fart this morning. Where do I supply this parameter?

Msg 201, Level 16, State 4, Procedure GetDirDetails, Line 0
Procedure or function 'GetDirDetails' expects parameter '@piFullPath', which was not supplied.
Post #763236
Posted Friday, July 31, 2009 10:32 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 9:58 AM
Points: 36,995, Visits: 31,517
Look at the section of the code that I provided called "Usage:"

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #763250
Posted Friday, July 31, 2009 11:41 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 5:26 PM
Points: 219, Visits: 1,156
Thanks! Having one of those days....
Post #763298
Posted Friday, August 7, 2009 12:38 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 5:26 PM
Points: 219, Visits: 1,156
Jeff,

Just wanted to thank you again. That procedure has really come in handy in multiple scenarios.

-tjm
Post #767212
Posted Friday, August 7, 2009 1:08 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 9:58 AM
Points: 36,995, Visits: 31,517
Michael Valentine Jones (7/22/2009)
This is a farily simple method:
declare @files table (cmdout nvarchar(100) )

insert into @files ( cmdout )
-- Get filenames excluding directories
exec master.dbo.xp_cmdshell 'dir C:\ /b /a:-d'

select cmdout from @files where cmdout is not null order by cmdout

Results:
cmdout                                                                                               
-------------------
AUTOEXEC.BAT
BOOT.BAK
boot.ini
cmldr
CONFIG.SYS
IO.SYS
license.txt
MSDOS.SYS
ntdetect.com
ntldr
pagefile.sys




Simpler still is EXEC Master.dbo.xp_Dirtree 'path/filename',1,1 but that isn't what the OP asked for either. He wants the dates for each file, as well.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #767235
Posted Friday, August 7, 2009 1:09 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 9:58 AM
Points: 36,995, Visits: 31,517
tjm (8/7/2009)
Jeff,

Just wanted to thank you again. That procedure has really come in handy in multiple scenarios.

-tjm


That's absolutlely awesome. Thanks for the feedback!


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #767236
Posted Monday, August 10, 2009 1:14 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, March 17, 2010 1:44 PM
Points: 7, Visits: 32
How do I email the list of filenames from the table? I'm using SQL 2005 and have configured Database Mail.
Post #768124
Posted Wednesday, September 16, 2009 7:43 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, August 28, 2014 7:42 AM
Points: 4, Visits: 68
Jeff,

This procedure works great but when I use it to read a directory that has more than 255 files in it the file names and details for the row numbers >=256 are the same as row number 255. The row number increases but the name, path , short name etc read the same as row 255. Any ideas?

Thanks,

E
Post #789369
Posted Thursday, September 17, 2009 7:01 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 9:58 AM
Points: 36,995, Visits: 31,517
Could you post or attach rows 250 to 260 so I can see what you mean and try to duplicate the problem?

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #790052
« Prev Topic | Next Topic »

Add to briefcase ««1234»»»

Permissions Expand / Collapse