xp_dirtree is an UNdocumented SQL procedure. you can use it to get a list of folders in a directory, including sub-folder to any depth!!!
EXEC master..xp_dirtree '[directory_path]', [depth]
for example:
EXEC master..xp_dirtree 'c:\Installs', 1
will get you a list of folders in the directory c:\Installs.
another example
EXEC master..xp_dirtree 'c:\Installs', 1
will get you a list of folders in the directory c:\Installs AND all the folders under these folders (2 levels down)
small query that can make your life easier sometimes.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment