July 23, 2004 at 12:57 pm
I'm looking to capture inside a database some information regarding files and their sizes when they get created and analyze that over time.
I've been trying to figure out a way to use the DIR command line command and parse the filename and filesize info into SQL but no luck yet.
ANyone have any ideas on how to do this or offer alternative suggestions.
Am using DTS utility to capture the info.
thks
July 23, 2004 at 1:08 pm
You could use the filescriptingobject within vb in a dts.
July 23, 2004 at 1:20 pm
create table #T1 (file_info varchar(255))
insert into #T1 exec master..xp_cmdshell 'dir *.*'
drop table #T1
July 27, 2004 at 6:00 pm
EXEC master..xp_dirtree 'c:\mydir', 1, 1
xp_dirtree is not documented in on-line help, but it does work. Param 2 affects the search depth so 1 = current dir. It returns files and directories which you can distinguish by each record's file attribute. If you're using a UNC on a shared drive ensure you have network access privileges.
July 27, 2004 at 9:06 pm
In addition to xp_dirtree, you can use xp_getfiledetails to return detailed information about a file or folder.
eg: xp_getfiledetails 'C:\Temp\test.txt'
--------------------
Colt 45 - the original point and click interface
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply