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 |
Madhu_sms
Starting Member
2 Posts |
Posted - 2015-05-04 : 10:00:18
|
Hi friends, Can you please help me to give the logic for finding folders in specified drive. As an example below:Declare @NewDrive varchar(1)Set @NewDrive = 'C'DECLARE @StringValue varchar(2000)SET @StringValue = 'C:\Drive1\Folder1\db3.ndf' I need to find whether the folders in @StringValue exits in @NewDrive or not. If not should create it.@StringValue can have many folders.Please help me as soon as possible and i am having less time to do it.RegardsMadhuMadhusudhan |
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
|
Madhu_sms
Starting Member
2 Posts |
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2015-05-05 : 02:27:57
|
[code]exec xp_cmdshell 'IF EXIST C:\folder\NUL ECHO folder exists'[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2015-05-06 : 01:14:24
|
To check if it doesn't exist and then create the folderIF not exist C:\folder (mkdir C:\folder)Jack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
|
|
|