Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

folderExists --

Status
Not open for further replies.

link9

Programmer
Nov 28, 2000
3,387
US
Morning all --

Well, so I am trying to use a fileSystemObject to create an intranet site that will create a folder based on a project number -- in order for the new project number to be taken out, two things have to be false:
1 - the project number can't be in the database already
2 - there can't be a folder on our network drive that already bears the name of the project...

#2 is the one giving me fits -- I can't seem to get the .folderExists property to return to me what I know to be true -- that a folder already exists...

Here's the code:
Code:
....
while folderExists
	theFolder = "Z:\" & projectNum
	if not(zDrive.FolderExists(cstr(theFolder))) then
		Response.Write("I DON'T EXIST! -- " & theFolder)
		folderExists = false
	else
		Response.Write("I EXIST! -- " & theFolder)
		temp = right(projectNum, 3)
		temp = cint(temp)
		temp = temp + 1
		temp = cstr(temp)
		if len(temp) = 2 then
			temp = "0" & temp
		end if
		projectNum = left(projectNum, 5)
		projectNum = projectNum & temp
	end if
wend

Now, basically, what's going on there is that before the loop, I look in a database, move to the last project number, and add 1 to it to come up with the latest project number. I then go to the network drive (z:\) to see if there is a folder there that already has the name... if there is, then I add another 1 to the name, and check again.

Once I have a project number that is in neither place, I'm good. The problem is that currently, the latest project number is 2001-061 in the database, but there is already a folder named that on z:\ -- I'm in the test phase here -- I made that folder on purpose to test the logic up there --

So I output the value, "z:\" & theFolder & it gives this:

z:\2001-061

Which EXISTS on z:\ already, but always returns false when I ask .folderExists

**sigh** I also tried putting a trailing backslash on the path, and got no dice.

I have asked .driveExists("z:\") and got true, so I know the program can see the drive just fine --

I'm out of ideas here, and am hoping someone can point out my mistake. What am I missing here?

Thanks for any input! :)
Paul Prewett
 
Good afternoon,
(some people do actually live in another time-zone :) )

Have you tried the folderexists function on another folder that exists on the z-drive? Does it also return false?

If not, is the notation of your last record in the database different from the others?

The folderexists method will also return false if you don't have permissions to access the drive.

Hope some of the above helps,

Have a nice day!

Jordi Reineman
 
Good evening!
Maybe too obvious, but how about the permissions of user IUSER_XXXXXX?

For testing: is it possible to test for z:\test ?

br
Gerard
(-:

Better a known bug then a new release.
 
jjr - yes, it also returns false --

foxbox - we cannot see anything past the root -- i.e. - we see the drive, but no folders whatsoever.

Through discussions on the vb forum, we've figured out that it is permissions and the network admin and I are trying to run it down as I'm typing here --

If anyone has had this problem before, and came up with the solution, we would really appreciate the benefit of your experience. It's working us both over.

thx
paul :)
 
I had no idea EXPERTS were human too ;-)
I created a form and allowed users to search for a folder name first.

<%
sSearch = Request(&quot;search&quot;)
Set fs=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
If fs.FolderExists(sSearch) = true Then
Response.Write(&quot;Folder &quot; & sSearch & &quot; exists.&quot;)
Else
Response.Write(&quot;Folder &quot; & sSearch & &quot; does not exist.&quot;)
End If
set fs=nothing
%>
&quot;The reward of one duty done is the power to fulfill another&quot;
<%
Jr Clown
%>
 
Oh yes -- EXTREMELY human :)

Actually, what it wound up being, as I stated above, was a permissions problem on the server, and, strangely enough, even our network admin was stumped by this one.

What I'm going to wind up doing is installing IIS on the server that actually hosts the z:\ drive, and then hosting this particular site on that server, so that it's a local drive in question, rather than a network drive --

A bit of a hack -- but whatever works, right? ;-)

thx for everyone's input. isn't this site great?!?

paul
 
Cool ;-) &quot;The reward of one duty done is the power to fulfill another&quot;
<%
Jr Clown
%>
 
Good morning! LOL

>isn't this site great?!?
YES! And happely we do not live in one country, so problems get fixed, when you are asleep . . . |-I



br
Gerard
(-:

Better a known bug then a new release.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top