Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Verify Directory Exists and Create if Necessary

By dlineberry,

This script will check to see if a directory exists and if it does not then it will create the directory. I did not create this as a stored procedure but it certainly could be. I tend to just place this as one of my job steps so I can create a backup file of an import file. I also run another script just like this one immediately afterwards but it looks to verify the month folder exists and creates it inside this year folder (both could easily be run together). And finally I run a script to move and rename my import file to the directorys verified and/or created for the current year and month.

Total article views: 598 | Views in the last 30 days: 5
 
Related Articles
SCRIPT

Script to Restore Entire database from a directory

Script to restore the entire databases from the backup directory just by passing the backup director...

FORUM

Creating SQL Server 2000 Virtual Directories

Creating IIS SQL Server 2000 Virtual Directories

FORUM

Create Login Script

Error with Create Login Script

FORUM

Scripting help - Need a query to find filenames and filepaths under a certain directory

Scripting help - Need a query to find filenames and filepaths under a certain directory

FORUM

Shared Directory

Shared Directory

Tags
miscellaneous    
sqlinsider scripts    
t-sql    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

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.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones