Checking for a folder?

R

Rob Meade

Hi all,

I am allowing a user to create a directory within my application.

I have them entering the name for the directory in a form. When the form is
processed I initially check for any special characters that are not allowed
(Windows based server incidently), from here I then need to check to see
whether the folder name has already been used (either by a previous entry
using the application etc, or reserved names as such ie, /images and so
forth)...

If anyone could suggest a possible solution for this I would be grateful, I
am running this on their hosting companies server, but I dont want to check
the entire disc etc, just within their hosting folder/path - and only at the
root level...

The idea being that it will create directories that are browseable at a
later stage, so when they are created I want :

http://www.domain.com/directory_name_here <-- and thats the level I want to
be checking for the name they've entered etc..

Hope this makes some sence...

Thanks for any help,

Regards

Rob
 
J

JOhn Beschler

Actually it is fairly easy using the scripting
FileSystemObject to check for the existence of a folder.

Dim FSO, Folder
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Folder = (name and path of folder goes here)
If FSO.FolderExists (Folder) Then
'What to do if folder exists
Else
' what to do if it does not exist.
End If

You can use Server.Mappath to find the physical directory
that your website lives in.

HTH,
John
 
R

Rob Meade

...
Dim FSO, Folder
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Folder = (name and path of folder goes here)
If FSO.FolderExists (Folder) Then
'What to do if folder exists
Else
' what to do if it does not exist.
End If

You can use Server.Mappath to find the physical directory
that your website lives in.

Cheers John thats great, will go give it a whirl now :)

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,136
Messages
2,570,795
Members
47,346
Latest member
Jason Calder

Latest Threads

Top