Export-DbaScript: How can I make it make a directory if it doesn't already exist?
0
votes
1
answer
144
views
I like to use
Export-DbaScript
to export to folders that are named C:\TargetFolder\Database\Schema
. Often, I don't already have a Database\Schema
folder, which will cause Export-DbaScript
to fail to write to that folder. Is there any way to make Export-DbaScript
create the folder if it doesn't already exist? I'm expecting something like a -Force
parameter, but I have not found it in the documentation.
I'm doing
Export-DbaScript `
-InputObject $_ `
-NoPrefix `
-NoClobber `
-FileName "$($MyLocation)\$($_.Database)\$($_.Name).sql
When the path doesn't exist, I get System.IO.DirectonaryNotFoundException
s. I'm on version 2.1.18
Asked by J. Mini
(1225 rep)
Jul 5, 2024, 06:35 PM
Last activity: Jul 7, 2024, 03:07 PM
Last activity: Jul 7, 2024, 03:07 PM