Platinum Partner

Find Exact Directory Name Of Variable Directory Name

This sql server procedure help you, if you have remmember some string of your directory and path name then you will get the exact directory name of that path.


create proc usp_srchDir
(
	@pathName nvarchar(100),
	@strDirName nvarchar(50),
	@ExactName nvarchar(20) OUTPUT
)
AS
BEGIN
	SET NOCOUNT ON
	DECLARE @strCMD nvarchar(500)
	SET @strCMD='dir  "'+ @pathName +'" /ad/o | find /I "'+@strDirName+'"'
	create table tblFindDIR(SearchDIRName nvarchar(200))
	insert into tblFindDIR(SearchDIRName)	
	exec master.dbo.xp_cmdshell @strCMD
	delete from tblFindDIR where isnull(SearchDIRName,'')=''
	select @ExactName=ltrim(rtrim(right(SearchDIRName,20))) from tblFindDIR where SearchDIRName like '%'+@strDirName+'%' 
	drop table tblFindDIR
	SET NOCOUNT OFF
END

GO

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}