如何使用 SQL Server 列出文件夹内的文件 [英] How to list files inside a folder with SQL Server

查看:20
本文介绍了如何使用 SQL Server 列出文件夹内的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用 xp_cmdshell 存储过程的情况下列出 SQL Server 中文件夹内的文件?

How do I list files inside a folder in SQL Server without using the xp_cmdshell stored procedure?

推荐答案

您可以使用 xp_dirtree

它需要三个参数:

根目录路径,深度,您希望获取的文件和文件夹以及最后一个用于仅显示文件夹或同时显示文件夹和文件.

Path of a Root Directory, Depth up to which you want to get files and folders and the last one is for showing folders only or both folders and files.

示例:EXEC xp_dirtree 'C:\', 2, 1

这篇关于如何使用 SQL Server 列出文件夹内的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆