Thank this author by sharing:
By Mandeep Dulai,
Step 1 - Run SQL Script to create table to hold file configuration values ( eg. file name, path)
Step 2 - Create a SQL Agent job with a step of type Powershell and copy and paste the powershell script into the step
As a member of SQLServerCentral, you get free access to loads of fresh content: thousands
of articles and SQL scripts, a library of free eBooks, a weekly database news roundup,
a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals
that makes it such a success.