473,387 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Checking for a folder?

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
Jul 19 '05 #1
3 2842
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

-----Original Message-----
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 isprocessed I initially check for any special characters that are not allowed(Windows based server incidently), from here I then need to check to seewhether the folder name has already been used (either by a previous entryusing the application etc, or reserved names as such ie, /images and soforth)...

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

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

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

Hope this makes some sence...

Thanks for any help,

Regards

Rob
.

Jul 19 '05 #2
"JOhn Beschler" wrote ...
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
Jul 19 '05 #3
"JOhn Beschler" wrote ...

[..snip..]

Cheers John, that was perfect :)

Regards

Rob
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Huahe | last post by:
Hello, Can someone help me with this problem. I select an folder using an folderbrowserdialog. I want to check if the selected folder contains any files or folders. If it does, i want to check...
0
by: Jeff | last post by:
I am trying to write some C# code that will allow me to determine if the current user running my application has "write" permissions to a particular folder. However, I can't seem to get it to...
2
by: Brian Henry | last post by:
How with out creating a COM object, do you check in .NET to see if a folder exists? I found the check for a file but i need to check for a folder, and there does not seem to be on in the path class
1
by: Kevin F | last post by:
I'm trying to use the following code to get my remote server's folder size information. Unfortunately, i'm getting the error: Traceback (most recent call last): File...
4
by: garyusenet | last post by:
I want to write a quick and simple programme to update a shortcut on about 20 peoples workstations. They will all have the same shortcut, so I thought the simplest way would be to create the...
2
by: Argonath | last post by:
Hi, I'm afraid this will no doubt horrendously basic as I'm a complete newbie to VB and have dived in without learning to do much... Start in the deep end and all. So if anyone could help, I'd...
1
by: halcyon943 | last post by:
have 4 folders that I watch and need to move files from to another location. Three constraints: -Finish time. Make sure the program stops transferring files at a specific time -Number of...
2
by: patelxxx | last post by:
Checking the folder before actually creating the new folder . Can someone guide me in what 'Checks' do I need to do before I create a new folder? I know that one of the checks will be to see if...
1
by: cosmos22 | last post by:
Hello, I have programmed some coding that copies my .exe to the start up folder, so it will execute on start up. I plan to use this to prompt the user of information, once I can get by this problem:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.