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:
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
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