Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return File Creation Date to SP 1

Status
Not open for further replies.

SQLBI

IS-IT--Management
Jul 25, 2003
988
GB
Hi,

I have a proc that checks for the existance of a file in a network folder using xp_fileexist.

Is there a way of returning the date a particular file was created using this or a similar method?

Thanks in advance.

Cheers,
Leigh

The problem with common sense is that it isn't that common!


 
Evaluate the leftmost part of the record returned by this code.

set nocount on
set transaction isolation level read uncommitted


declare @l_vtablename varchar(128)
declare @l_vsqlstring varchar(1024)
declare @p_vdirectory varchar(128)
declare @p_vfilename varchar(128)



set @p_vdirectory = 'directory'
set @p_vfilename = 'filename'
create table #tchecktable (output varchar(512))



set @l_vsqlstring = 'dir ' + @p_vdirectory+@p_vfilename
--populate the table with the directory info

insert into #tchecktable exec master..xp_cmdshell @l_vsqlstring

--strip out everything except the entry for the file
DELETE FROM #tchecktable WHERE output is NULL
OR right(rtrim(output),len(@p_vfilename)) <> @p_vfilename

select * from #tchecktable


drop table #tchecktable

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'll have the roast duck with the mango salsa.
 
Phil, Awesome worked perfectly.

Thanks very much!

Cheers,
Leigh

The problem with common sense is that it isn't that common!


 
Glad to help, Leigh.

BTW I'm a walleye guy, myself. Or stripers off Block Island; either one'll work.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'll have the roast duck with the mango salsa.
 
Big or small we love em all!!!

Nice to meet a fellow angler, tight lines Phil!

Cheers,
Leigh

The problem with common sense is that it isn't that common!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top