FolderDelete

Deletes a Folder and its content

  • Stored Procedure
  • SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017

Syntax:

EXEC SQLHTTP.net.FolderDelete @FolderPath

Arguments:

Name Type Description
@FolderPath varchar(MAX) Full path to a folder
@Recursive bit 1 = All directories, subdirectories, and files in FolderPath will be deleted first
0 = Existing directories, subdirectories, and files in FolderPath will NOT be deleted. If any exist, an error will be raised.

Remarks:

Accessing the file system will be performed in the context of the SQL Server instance process. You can set SQL Server to run using a specific network account, or a Local System Account.

Sample Usage:

Recursive delete of a folder:
Non-Recursive delete of a non-empty folder:

See Also: