Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Error in CreateFolder()?

Reply
Thread Tools

Error in CreateFolder()?

 
 
anjelone
Guest
Posts: n/a
 
      04-14-2006
Hi.

When I use CreateFolder() to create a folder with a space at the end,
it creates the folder successfully, but still errors out with a "Path
not Found" error.

For example:
<%
Dim strCurrentPath

strCurrentPath = "c:\test folder \

If Not oFO.FolderExists(strCurrentPath) Then
oFO.CreateFolder(strCurrentPath) 'Errors on this line.
End If
%>

After the folder is created, it cannot be deleted or renamed
immediately. I think there still must be some process attached. The
error when trying to delete it is: "Cannot delete file: Cannot read
from the source file or disk."

I need to be able to leave the space in for now.

Any ideas on why this occurs?

Thanks!

 
Reply With Quote
 
 
 
 
anjelone
Guest
Posts: n/a
 
      04-14-2006
Just as a follow on, I can get around this by adding "on error" around
the createFolder(), but I'd rather get to the bottom of the error.

Here is an example of something I would do:

<%
Dim strCurrentPath
Dim strErrNum, strErrMessage

strCurrentPath = "c:\test folder \

If Not oFO.FolderExists(strCurrentPath) Then
On Error Resume Next
oFO.CreateFolder(strCurrentPath)
If Not oFO.FolderExists(strCurrentPath) Then
strErrNum = Err.number
strErrMessage = Err.Description
End If
On Error GoTo 0
If Len(strErrMessage) > 0 Then
Err.Raise strErrNum, "CreateFolder(), strErrMessage
End If
End If
%>

 
Reply With Quote
 
 
 
 
anjelone
Guest
Posts: n/a
 
      04-14-2006
After some investigation, it appears that if you leave off the trailing
"\" on the path, the folder gets created successfully with no error,
and the trailing space gets stripped off.

Unfortunately, with FileExists() if you are looking for "c:\test
\folder\test.txt" it won't strip and it won't match.

On a brigher note (slightly) this is taken care of in asp.net with all
trailing spaces removed on exists() and createfolder() with or without
the final "\".

 
Reply With Quote
 
Slim
Guest
Posts: n/a
 
      04-15-2006
I cant see why you would want to create a folder with a space at the end?

"anjelone" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> After some investigation, it appears that if you leave off the trailing
> "\" on the path, the folder gets created successfully with no error,
> and the trailing space gets stripped off.
>
> Unfortunately, with FileExists() if you are looking for "c:\test
> \folder\test.txt" it won't strip and it won't match.
>
> On a brigher note (slightly) this is taken care of in asp.net with all
> trailing spaces removed on exists() and createfolder() with or without
> the final "\".
>



 
Reply With Quote
 
anjelone
Guest
Posts: n/a
 
      04-17-2006
We use user input project names to create folders and then reference
those project names to read from those folders. This is a legacy aspect
of the system that will definitely change, but it is so integrated at
this point that it needs to stay for the time being.

I'm hoping it will be converted to a better system in the next 2
months, but the show must go on until then.

Anyway, it is interesting to see the inconsistencies and I can't be the
first to be bitten by it...

 
Reply With Quote
 
Slim
Guest
Posts: n/a
 
      04-17-2006
I still don't understand

Why cant you just use Trim(folderName) to get rid of the space?

"anjelone" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> We use user input project names to create folders and then reference
> those project names to read from those folders. This is a legacy aspect
> of the system that will definitely change, but it is so integrated at
> this point that it needs to stay for the time being.
>
> I'm hoping it will be converted to a better system in the next 2
> months, but the show must go on until then.
>
> Anyway, it is interesting to see the inconsistencies and I can't be the
> first to be bitten by it...
>



 
Reply With Quote
 
anjelone
Guest
Posts: n/a
 
      04-19-2006
When beginning development, you are correct. Just use Trim or something
similar.

*Code written w/o vars for ease.
So I:
CreateFolder(TRIM("c:\test "))
Then I want to put another folder in that first one from a different
section of the site at a different time:
CreateFolder(TRIM("c:\test \test2 "))

Ooops!
I trimmed the first CreateFolder so now when creating the second I have
to trim both...
CreateFolder(TRIM("c:\test ") + TRIM("\test2 "))

And what happens when I use FileExists or FolderExists? Same
thing....Trim's on everything.

In my case I would have to add that in approximately 200 files of code,
multiple times in some of them.
For a set of code used in 16 seperate production sites, that is a lot
of changing and a whole lot of testing.
Not to mention that file uploading, downloading and manipulation are
integral to our product so if something went wrong with that it would
be a major issue.

Again, "I'm hoping it will be converted to a better system in the next
2 months, but the show must go on until then."

Plus, I'm not condoning this "trailing space" practice in any way, mind
you, it is simply the code I'm dealing with. You must understand the
position of walking into old badly developed code and having to deal
until you can correct it...

 
Reply With Quote
 
Slim
Guest
Posts: n/a
 
      04-19-2006

"anjelone" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> When beginning development, you are correct. Just use Trim or something
> similar.
>
> *Code written w/o vars for ease.
> So I:
> CreateFolder(TRIM("c:\test "))
> Then I want to put another folder in that first one from a different
> section of the site at a different time:
> CreateFolder(TRIM("c:\test \test2 "))
>
> Ooops!
> I trimmed the first CreateFolder so now when creating the second I have
> to trim both...
> CreateFolder(TRIM("c:\test ") + TRIM("\test2 "))
>
> And what happens when I use FileExists or FolderExists? Same
> thing....Trim's on everything.
>
> In my case I would have to add that in approximately 200 files of code,
> multiple times in some of them.
> For a set of code used in 16 seperate production sites, that is a lot
> of changing and a whole lot of testing.


where are the stored?
lop though them

using the 1 line of code including trim?


> Not to mention that file uploading, downloading and manipulation are
> integral to our product so if something went wrong with that it would
> be a major issue.
>
> Again, "I'm hoping it will be converted to a better system in the next
> 2 months, but the show must go on until then."
>
> Plus, I'm not condoning this "trailing space" practice in any way, mind
> you, it is simply the code I'm dealing with. You must understand the
> position of walking into old badly developed code and having to deal
> until you can correct it...
>



 
Reply With Quote
 
anjelone
Guest
Posts: n/a
 
      04-19-2006
Folder names are project names, task names, contract names, review
names, location names and report names that users input. All files
associated with all those things go into the folder named for that
thing.

 
Reply With Quote
 
Slim
Guest
Posts: n/a
 
      04-20-2006

"anjelone" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Folder names are project names, task names, contract names, review
> names, location names and report names that users input. All files
> associated with all those things go into the folder named for that
> thing.
>


I'm mean in a programming sense, you must have them in a database or a array
or something,

there for you only have to use Trim once and loop though your collection


 
Reply With Quote
 
 
 
Reply

Thread Tools

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
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xffc Thread 0x228 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-30-2006 03:16 PM
Error connecting to SQLExpress 2005 locally (error: 26 - Error Locating Server/Instance Specified) hfk0 ASP .Net 2 03-27-2006 08:43 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 1 03-24-2006 04:20 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-24-2006 02:22 PM
Error 500: ERROR: Cannot forward. Writer or Stream already obtained. Error JavaQueries Java 1 03-01-2005 06:30 PM



Advertisments