PC Review


Reply
Thread Tools Rate Thread

Checking to see if Directory exists and making it.

 
 
Steven M. Britton
Guest
Posts: n/a
 
      15th Jun 2004
How can I check to see if a directory exists and if it
doesn't make it and if it does export my file into it.
 
Reply With Quote
 
 
 
 
jmonty
Guest
Posts: n/a
 
      15th Jun 2004
Try something like this:

If Len(Dir("C:\Test", vbDirectory)) > 0 Then
FileCopy "C:\source.txt", "D:\destination.txt"
End If

substitute your file/directory names or
string variables for the directory and file
paths/names if you'd prefer.



>-----Original Message-----
>How can I check to see if a directory exists and if it
>doesn't make it and if it does export my file into it.
>.
>

 
Reply With Quote
 
Steven M. Britton
Guest
Posts: n/a
 
      15th Jun 2004
Seems my most important part of the question was
overlooked.

How can I check to see if a directory exists and if it
doesn't make it.

>-----Original Message-----
>Try something like this:
>
> If Len(Dir("C:\Test", vbDirectory)) > 0 Then
> FileCopy "C:\source.txt", "D:\destination.txt"
> End If
>
>substitute your file/directory names or
>string variables for the directory and file
>paths/names if you'd prefer.
>
>
>
>>-----Original Message-----
>>How can I check to see if a directory exists and if it
>>doesn't make it and if it does export my file into it.
>>.
>>

>.
>

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      15th Jun 2004
If Len(Dir("C:\Test", vbDirectory)) = 0 Then
' Directory doesn't exist. Create It
MkDir "C:\Test"
End If

Note that you cannot do

If Len(Dir("C:\Test\Subfolder", vbDirectory)) = 0 Then
' Directory doesn't exist. Create It
MkDir "C:\Test\Subfolder"
End If

if Test doesn't already exist.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Steven M. Britton" <(E-Mail Removed)> wrote in message
news:1ce8601c45322$9a80c3e0$(E-Mail Removed)...
> Seems my most important part of the question was
> overlooked.
>
> How can I check to see if a directory exists and if it
> doesn't make it.
>
> >-----Original Message-----
> >Try something like this:
> >
> > If Len(Dir("C:\Test", vbDirectory)) > 0 Then
> > FileCopy "C:\source.txt", "D:\destination.txt"
> > End If
> >
> >substitute your file/directory names or
> >string variables for the directory and file
> >paths/names if you'd prefer.
> >
> >
> >
> >>-----Original Message-----
> >>How can I check to see if a directory exists and if it
> >>doesn't make it and if it does export my file into it.
> >>.
> >>

> >.
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making Directory if None Exists Orion Cochrane Microsoft Excel Programming 5 4th Sep 2009 02:26 PM
directory.exists occassionally locks up when checking network share Keith Langer Microsoft Dot NET Framework 8 3rd Sep 2006 03:49 PM
checking to see if DDL value exists Darrel Microsoft ASP .NET 4 10th Dec 2004 03:23 PM
Directory.Exists(path) creates a directory =?Utf-8?B?U3RyaWc=?= Microsoft Dot NET Framework 4 5th Sep 2004 06:33 PM
HELP: Checking if directory exists off of web root VB Programmer Microsoft ASP .NET 0 22nd Oct 2003 03:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:54 AM.