troubleshooting Question

SQL Server 2008 - How to delete FileName physical path folder if exists?

Avatar of sbornstein2
sbornstein2 asked on
Microsoft SQL Server
10 Comments1 Solution616 ViewsLast Modified:
Hello all,

I am getting an error as we have a deployment script where we enable filestream.  The script it:


If the path already exists after a previous deploy:  'C:\MYDBFILES' then I get the error:
Cannot create file 'C:\MYDBFILES' because it already exists. Change the file path or the file name, and retry the operation.

How can I handle this?  I am thinking best option is to delete the whole file folder as it is being backed up anyway.   Any suggestions?   On a QA server if we added a GUID etc it will have a lot of folders getting created.

Surendra Nath
Technology Lead

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros