Tag Archives: Script to create folder using SSMS

Script to create Folder/Directory using SSMS

One of my blog reader requested that, how to create the directory using Script/SSMS. Here is the answer.


— Below query will list out the directories on C drive
EXEC MASTER.sys.Xp_dirtree ‘C:\JugalA’

— Below query will create the folder JugalA on C drive
EXEC MASTER.dbo.Xp_create_subdir ‘C:\JugalA’

— Below query will create the folder JugalB on C:\JugalA drive
EXEC MASTER.dbo.Xp_create_subdir ‘C:\JugalA\JugalB’